Re: Trying to keep a dropdown selection sticky

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael S. Dunsavage wrote:
I have a form I want to keep sticky, but I can't figure out how. I got
all the <INPUT>'s to be sticky....

The select script


<?php
echo '<strong>State</strong><br>';
echo '<select name="State">';
	foreach ($state_list as $key => $value) {
		echo "<option value=\"$key\"> $value</option>\n";
	}
echo '</select>';
echo '<br>';



?>


If I'm reading this correctly you mean if the value has been selected before select it again?
If so way I did it was by checking the database value
 eg
echo "<option value=\"$key\"
if ($row[id] == $key) {
      print "SELECTED"; }
echo "> $value </option>\n";

Peter Jackson


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux