Jump to content

posting form list multiple values ??


jaikar

Recommended Posts

Create multiple select list like this

 

<select name="field_name[]" id="field_name[]" multiple="multiple" size="3"><option value="1">A</option><option value="2">B</option><option value="3">C</option><option value="4">D</option></select>

 

In PHP you will get the values as an array of field_name in $_GET or $_POST whatever method you are using for form submission.

 

$my_field = $_GET['field_name'];
foreach($my_field as $key=>$value){
//loop through the array of selected items
}

 

Exceeleeeeeeeeenttt !!........ Thanks a lot !...

 

you are the best Syed !!.......

 

i have on more Q.... is it possible to post the values without selecting it. my idea is that, there will be 2 list box and the user will move the items in one list box to the other list box and click submit. not i want to put all the data in the 2nd list box to the database. in this case the user has to select the items after moving correct ? but i want the user just to move the items and submit and the values in the 2nd list box should go to dbase.. is this possible ?

 

Thanks again !!..

 

~J

 

you are correct, but the list is quite big, so if i have 2 list box, it could be easy for the user to see what he have selected.... its only for the user friendly interface.... if its possible, how to do it ?.. can  you tell me any logic.. i had a logic that will select all the values while submit, butit did not worked for me.. can you help ?

 

Thanks !!

Archived

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

×
×
  • 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.