Jump to content

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

 

  • 2 weeks later...

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

  • 3 months later...
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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.