RE: [PHP-DB] how to insert an id to a mysql table from a html sel ect option
| From: | matt stewart | Date: | Wed, 07 Nov 2001 11:56:48 +0000 |
| Subject: | RE: [PHP-DB] how to insert an id to a mysql table from a html sel ect option | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14085@lists.php.net to get a copy of this message | ||
Why not just when you're filling the <select> options with the town names,
also fill in the values as the town_id?
ie -
if ($myrow=mysql_fetch_array($result)){
do {
print"<option
value=\"$myrow[town_id]\">$myrow[town_name]</option>
}while($myrow=mysql_fetch_array($result));
}
then you can just insert the value selected!
-----Original Message-----
From: Ivan Carey [mailto:icarey@iname.com]
Sent: 07 November 2001 11:47
To: php-db@lists.php.net
Subject: [PHP-DB] how to insert an id to a mysql table from a html
select option
I would like to be able to fill a <select> option in a form with the
town_name and send its corresponding id to a mysql table.
Town Table
Detail Table
****************************
************************
* town_id * town_name * *
mem_id * town_id *
****************************
************************
* 1 * Wang * *
1 * 1 *
* 2 * Albury * *
2 * 3 *
* 3 * Yarra *
*************************
****************************
I can fill the <select> options with the town_name from the mysql Town Table
ok. what I would like to do is when
the user selects the town say Wang, the associated id of 1 is inserted into
the Detail Table, this then joins
both tables by the town_id
How may this be possible?
Thanks Ivan
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.291 / Virus Database: 156 - Release Date: 25/10/01
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.291 / Virus Database: 156 - Release Date: 25/10/01