RE: MultiSelect List Box in PHP

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

 



here is my total code for this file:
//note that the html structure isn't there yet but it still gives the
general idea

<?
include("libs/conf.db");
mysql_connect($host, $mysqluser, $mysqlpwd);
$query=mysql_query("select company from wata.members");
?>
<form method="post" action="<?echo $_SERVER['PHP_SELF'];?>">
<select name="members[]"  multiple>
<?
while($listbox=mysql_fetch_array($query)){?>
<option value="<?echo $listbox['company'];?>"><?echo $listbox['company'];?>
<?}?>
</select>

<input type="submit" value="submit">
</form>

<?
echo implode(", ",$_POST['members']);
?>
//end code...
result printed at bottom of page under submit button is this:
(only prints last element of array)

for some reason it seems that my array isn't being built right... you can
change it to work with your db just change the connect string and the field
list from a db to test it...


-----Original Message-----
From: Marek Kilimajer [mailto:lists@xxxxxxxxxxxxx]
Sent: Sunday, October 31, 2004 4:14 PM
To: Andy B
Cc: PHP mailing list
Subject: Re:  MultiSelect List Box in PHP


implode()

-- 
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