chum Posted January 29, 2008 Share Posted January 29, 2008 I'm in a little hole, but can't seem to get out of it. In HTML, you can make the <selected> tag to be able to select many options by holding down CTRL+click but how to i retrieve multiple information that was selected? example: <form method="post"....> <select name="example" multiple="multiple"> <option value=1>one</option> <option value=2>two</option> </select> </form> in PHP to retrieve that information would be $_post['example']..but what if both the option are selected, how do i retrieve both of them? Link to comment https://forums.phpfreaks.com/topic/88437-solved-retrive-multiple-selected-option/ Share on other sites More sharing options...
sasa Posted January 29, 2008 Share Posted January 29, 2008 try <form method="post"....> <select name="example[]" multiple="multiple"> <option value=1>one</option> <option value=2>two</option> </select> </form> and on php page use print_r($_POST['example']); Link to comment https://forums.phpfreaks.com/topic/88437-solved-retrive-multiple-selected-option/#findComment-452618 Share on other sites More sharing options...
Philip Posted January 29, 2008 Share Posted January 29, 2008 <select name="example[]" multiple="multiple"> options.... <?php if ($_post['example']){ foreach ($_post['example'] as $data){echo $data."<br />";} } ?> Link to comment https://forums.phpfreaks.com/topic/88437-solved-retrive-multiple-selected-option/#findComment-452619 Share on other sites More sharing options...
chum Posted January 29, 2008 Author Share Posted January 29, 2008 sweet Jesus! thanks both -solved- Link to comment https://forums.phpfreaks.com/topic/88437-solved-retrive-multiple-selected-option/#findComment-452724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.