Jump to content

Archived

This topic is now archived and is closed to further replies.

gopi_crishna

Multiple selected values from listbox to database

Recommended Posts

Hi ,

I am trying to select multiple values from a listbox and then pass all the selected values into the one field of the database ..i am not able to get that right ..

 

when i add this line of code

 

<select name="source_info[]" size="10" multiple>

 

 

something like "array" is getting stored in the database field instead of the selected items ..can any one help me in this

 

Thanks

 

Gopi

 

Share this post


Link to post
Share on other sites

hi there

 

in your script(i.e. the one that recieve the array) try to loop through the array

one by one and store each value. to be more clear:

 

let us assume that we are having the following array:

$select

use the following code to loop through array)

foreach ( $select as $mydata)

{

$result = mysql_query("insert into mytable(colsname) values('$mydata')");

}

 

try it and let me know if you need further help

Share this post


Link to post
Share on other sites
hi there

 

in your script(i.e. the one that recieve the array) try to loop through the array

one by one and store each value. to be more clear:

 

let us assume that we are having the following array:

$select

use the following code to loop through array)

foreach ( $select as $mydata)

{

$result = mysql_query("insert into mytable(colsname) values('$mydata')");

}

 

try it and let me know if you need further help

170189[/snapback]

 

Where exactly does one place this code? For example, I have the array created, but have no clue how to put that array into the database...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.