Gaia Posted April 30, 2006 Share Posted April 30, 2006 Hi,I have a form that has a multiple select ( where you can choose more then one option ) and i can't seem to figure out how to retrieve all the selected options with $_POST.When i changed to $_GET, it showed in the url &option=1&option=4&option=5, etc.So, I know they are being passed as the same variable, but I'm wondering how to retrieve them all via $_POST.Thanks. Link to comment https://forums.phpfreaks.com/topic/8761-_post-and-multiple-selects/ Share on other sites More sharing options...
Guest askjames01 Posted April 30, 2006 Share Posted April 30, 2006 if (isset($_POST['B1'])){ $contents = "Guest name: " . $_POST['gname'] . "\n\nState: " . $_POST['gstate'] . "\n\nZip: " . $_POST['gzip'] . "\n\nCountry: " . $_POST['gcountry'] . "\n\nE-mail: " . $_POST['gemail'];}i think this will give you an idea. Link to comment https://forums.phpfreaks.com/topic/8761-_post-and-multiple-selects/#findComment-32177 Share on other sites More sharing options...
Gaia Posted April 30, 2006 Author Share Posted April 30, 2006 What...No, I know how to get the value of a single input...but I dont know how with a multiple select....Thanks. Link to comment https://forums.phpfreaks.com/topic/8761-_post-and-multiple-selects/#findComment-32179 Share on other sites More sharing options...
kenrbnsn Posted April 30, 2006 Share Posted April 30, 2006 You need to make the name of your select an array, then the multiple selections will be in the array:[code]<select name='test[]'>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/8761-_post-and-multiple-selects/#findComment-32186 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.