gopi_crishna Posted October 21, 2004 Share Posted October 21, 2004 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 Quote Link to comment https://forums.phpfreaks.com/topic/2009-multiple-selected-values-from-listbox-to-database/ Share on other sites More sharing options...
ashoogy Posted October 31, 2004 Share Posted October 31, 2004 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 Quote Link to comment https://forums.phpfreaks.com/topic/2009-multiple-selected-values-from-listbox-to-database/#findComment-6631 Share on other sites More sharing options...
theatrehelper Posted February 11, 2005 Share Posted February 11, 2005 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... Quote Link to comment https://forums.phpfreaks.com/topic/2009-multiple-selected-values-from-listbox-to-database/#findComment-7111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.