adicrst Posted May 9, 2008 Share Posted May 9, 2008 i want to use some checkboxes in a php script, but it's not working <form action='' method='post'>language: <input type="checkbox" name="language" value="romanian"> Romanian <input type="checkbox" name="limba" value="english"> English <input type="checkbox" name="limba" value="japanese"> Japanase <input type="submit" name="submit" value="send"> </form><?phpif (isset($_POST['submit'])) { echo "Languages: ".$_POST['language']; }else { echo ' select langeuages'; } the thing is that if i select more then one option, it only gives me one record and the last onehow do i make it to show me all the options ? Link to comment Share on other sites More sharing options...
Wander Posted May 9, 2008 Share Posted May 9, 2008 put [] after the name, then php will have them in an array<input type="checkbox" name="language[]" value="Romanian" /><input type="checkbox" name="language[]" value="English" /><input type="checkbox" name="language[]" value="Japanese" />Selecting the first and second, will give in php:array( 'language' => array( 0 => 'Romanian', 1 => 'English' )) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.