Page 1 of 1

Multiple Selection using list box

Posted: Mon Jun 18, 2007 2:16 am
by sarbas
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi folks,

                   I'm using follwing code to select multple values.It's working.

Code: Select all

<td><select name="catorg" size="3" multiple="multiple" id="catorg">
	 <? $sql=mysql_query("select Category from business_by_category group by Category"); 
	     	   while($arr=mysql_fetch_array($sql))
			   	   { ?>
      <option><? echo $arr[Category]; ?></option>
   				   <?
				   }
	            ?>
   
    </select></td>
But when i try to insert selected values,mysql accepts only last selected value. But i want to insert multiple selected values.

Hopefully waiting for your reply

Regards
Sarbas


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Jun 18, 2007 2:18 am
by volka
try

Code: Select all

<select name="catorg[]"
$_POST['catorg'] or $_GET['catorg'] will be an array then.

Posted: Mon Jun 18, 2007 2:26 am
by sarbas
Thanks buddy.......It's working.....