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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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.