echo "<SELECT NAME=\"whatever\">\n";
while($row = mysql_fetch_assoc($yourquery)
echo "<OPTION ". ($whatever == $row['value']? "SELECTED ":"")
."VALUE=\"{$row['value']}\">{$row['name']}</OPTION>\n";
echo "</SELECT>\n";
Just insert a ternary operator in there, and check if the submitted
value is equal to the database row's value... If so, add "SELECTED" to
the OPTION tag.
--Matt
-----Original Message-----
From: Jared Mashburn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 12, 2001 6:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Dynamic Form
Hell0,
I have a MySql database with 3 columns. The first column is "id" second
is "name" and third is "value", I have two drop-down lists, with the
first filled with an array from the column "name". I would like for the
second drop-down list be changed according to the "value" of what has
been selected in the first drop-down list. I have fill that I'm going in
the right direction, but have run into a wall. Can anyone give me some
advice in doing this miraculous feat?
Thanks,
Jared
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]