loop within a <select multiple>

From: Date: Sun, 23 Mar 2003 01:29:30 +0000
Subject: loop within a <select multiple>
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8840@lists.php.net to get a copy of this message
Hello smarty-general, May I have you expert opinion on this please ? My goal within a template is : You select several values from a from (select multiple). After submitting the form, I save your choices to a session variable. Later on, if you need to make another search (or choose different option, I will remind you your previous choices. here is my code, but it needs optimization. I don't see where I can improve the code. Further, it's displaying each option twice. <SELECT MULTIPLE NAME="fonction[]" SIZE="15"> {section name=form loop=$fonction} {if $fonction[form].code} {* Check if saved variables from session are equal to the current list *} {section name=session loop=$smarty.session.search.fonction} {if $fonction[form].code==$smarty.session.search.fonction[session]} <OPTION VALUE="{$fonction[form].code}" SELECTED>{$fonction[form].label}</OPTION> {else} <OPTION VALUE="{$fonction[form].code}">{$fonction[form].libelle}</OPTION> {/if} {/section}} {/if} {/section} </SELECT> Please advise. Best regards, Jacques

« previous php.smarty.general (#8840) next »