RE: [PHP] Dynamic Form
| From: | Matthew Loff | Date: | Wed, 12 Sep 2001 22:51:16 +0000 |
| Subject: | RE: [PHP] Dynamic Form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67095@lists.php.net to get a copy of this message | ||
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:jmashburn@ubtanet.com]
Sent: Wednesday, September 12, 2001 6:45 PM
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net To
contact the list administrators, e-mail: php-list-admin@lists.php.net