Re: forms

From: Date: Sat, 09 Dec 2000 02:05:32 +0000
Subject: Re: forms
Groups: php.general 
Request: Send a blank email to php-general+get-29443@lists.php.net to get a copy of this message
Hello Thomas Holton, Saturday, December 09, 2000, 1:38:28 AM, you wrote: > Hello. I have a form page with drop down select lists. The data returned > from the form are displayed below the form. Originally i had this document > in frames using perl/cgi, and once the results for the query were > returned in the lower frame, the upper frames' drop down boxes were > unchanged. Now, the drop down boxes are reset after every query becuase > the entire page is returned. My question is: Is there some way of having > the drop down selections "remembered" from the previous queries? > -thanks in advance You must to make generate the drop-down box from the script and, when you find the good data must be make it selected. Something like this: ---- <? $fruits = array("apple","orange","kiwi"); ?> <FORM> <SELECT name=fruit> <? foreach ($fruits AS $fr) { $select = ($fruit == $fr)?"SELECTED":""; ?> <OPTION <?=$select?>><?=$fr?> <? } ?> </SELECT> <INPUT TYPE=SUBMIT> </FORM> ---- It is only work in php4. -- Best regards, Tamas Amon mailto:sajt@amon.hu

« previous php.general (#29443) next »