Re: populating list menus with mysql and for statements
| From: | Jason Wong | Date: | Sun, 09 Jun 2002 17:34:18 +0000 |
| Subject: | Re: populating list menus with mysql and for statements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101340@lists.php.net to get a copy of this message | ||
On Sunday 09 June 2002 17:27, electroteque wrote:
> hi i am populating a list menu with mysql , i would like to find a way to
> populate a form with more than one of the same list menus in a for loop
>
> <select name="type[]">
> <?
> while ($sample = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
> $typeID=$sample["typeID"];
> $description=$sample["description"];
> $sample_type[$sample['typeID']] = $sample["description"];
> echo "\n<option value=\"$typeID\"
> $selected>$description</option>";
> }
> ?>
> </select>
>
> i have this within a for loop but the list only shows up once and the
> second one is empty because the select from the database is finished ,
>
> is there a way to put the information from mysql into arrays so i can use
> it more than once and then i could do multiple populated list boxes ? let
> me know
use mysql_data_seek() to reset the row pointer.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
QOTD:
"She's about as smart as bait."
*/