|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Lukiluko Smarty n00b
Joined: 16 Oct 2012 Posts: 1
|
Posted: Tue Oct 16, 2012 1:39 am Post subject: html_options |
|
|
Hallo an das Forum,
ich bin relativ neu in Sachen SMARTY... also meine Frage an Euch ist:
Ich habe via html_options eine Auswahlliste erstellt, die auch befüllt und angezeigt wird. Nun möchte ich aber dass die Auswahl z.B. text1 an eine weitere Seite gesendet wird und dort auch Angezeigt. (nur die Auswahl)
Also im tpl habe ich folgendes:
<form action="action.php" method="post">
<select name="customer_id">
{html_options values=$cust_ids output=$cust_names selected=$customer_id}
</select>
<input type="submit" value="senden..">
</form>
[/code]
Code: |
//Das steht in meiner PHP
{php}
include_once('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_ids', array(1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010));
$smarty->assign('cust_names', array(
'Bitte wählen..',
'+/- 0.00 Dpt.',
'+ 0.25 Dpt.',
'+ 0.50 Dpt.',
'+ 0.75 Dpt.',
'+ 1.00 Dpt.',
'+ 1.25 Dpt.',
'+ 1.50 Dpt.',
'+ 1.75 Dpt.',
'+ 2.00 Dpt.',
'+ 2.25 Dpt.'));
$smarty->assign('customer_id', 1001);
$smarty->display('test.tpl');
{/php}
|
Nun mein Problem:
Wie rufe ich in meiner action.php die Ausgewählte option auf???
habe schon mit .$_POST['cust_ids'] ."; versucht aber ohne erfolg.
Ich hoffe auf Eure Hilfe.
Danke |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Tue Oct 16, 2012 6:28 am Post subject: |
|
|
Das hat doch jetzt nichts mit SMARTY an sich zu tun, das ist einfaches PHP.
Du schreibst
Code: | <select name="customer_id"> |
verwendest aber dann in deiner action.php den namen
Das wird natürlich nicht funktionieren. Du musst schon:
Code: | $_POST['customer_id'] |
verwenden! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|