Smarty Templates:
{{foreach from= $arr item=h key=i}}{{$h [0]}} {{/foreach}}
PHP page: if ($_post[' act ']== ") {//Enter page $SQL =" SELECT distinct stud_id from Stud_base "; $rs = $CONN->execute ($SQL) or Die ($SQL); $arr = $rs->getarray (); $smarty->assign ("arr", $arr); } if ($_post[' act ']== "inquiry") {//lookup button $y = $_post[' Cbo_grade ']; $smarty->assign ("arr", $y); Now I can do this in the button after the drop-down box or select the value, but it only appears the first character, the back of the not out, how to modify it? Or what better way to do it? Trouble Master to help, thank you. What does it mean to reply to a discussion (solution)? Describes the logical process in detail. The code is not affixed to the whole. {{$h [0]}} $smarty->assign ("Cbo_ Grade1 ", $_post[' cbo_grade1 ']); {{$h [0]}} $smarty->assign ("Cbo_ Grade1 ", $_post[' cbo_grade1 ']); Smarty seems to have not been transferred to AH? I changed the source of the group to $smarty->assign ("arr", $_post[' cbo_grade1 '); Press the Find button he only displays the first word .... Originally id= ' GB1234 ' is now transferred back only a G 、、、 I suddenly thought why only the first one came out {{foreach from= $arr item=h key=i}} {{$h [0]}}< /option> {{/foreach}}
Reason is < p="">
$h [i]
What is the format of your array? Prinr_r ($arr); Look
$_post[' Cbo_grade1 ');
I'm sure it's time to pass this value through {{foreach from= $arr item=h key=i}}
I split the value.A 1th value is displayed: How will $_post[' cbo_grade1 ');
Tied to a value that cannot be split, or how to change the drop box? Please answer the experts, thank you
Some of my arrays are all numbers and numbers and letters, a bit full of noon, I now have 3 drop-down boxes on the top of the Prinr_r ($arr); It seems to have been written wrong ... Print_r ($arr); Just right.
$_post[' cbo_grade1 ') equals the value you commit, which is a single value. Are you sure you can show all option?
I can't even get the value I chose $_post[' Cbo_grade1 ' back to the drop-down box. Also show all, I now think I choose the value of the drop-down box to click the button can also be the same, that is, the post value is passed back, do not let the drop-down box is empty on the line 、。。
Smarty specifically provides html_options template functions to solve the related operations of the list control
See http://www.php100.com/manual/smarty/language.function.html.options.html