sjones Posted December 8, 2007 Share Posted December 8, 2007 Hello, I am trying to have a form that gives a user 8 different choices. These would be with radio buttons. The user can select as many of those that they want, from 0-8. I then want to echo the results in the handle_form.php script. QUESTION: would I set up the form using something like: <input name="choice" type="checkbox" value="choice1"> <input name="choice" type="checkbox" value="choice2"> <input name="choice" type="checkbox" value="choice3"> or would I use <input name="choice1" type="checkbox" value="true"> <input name="choice2" type="checkbox" value="true"> <input name="choice3" type="checkbox" value="true"> And then I need to know how to get only the results that the user checked in the handle_form.php script. $choice = $_POST['choice']; for ($i =0; $i < count($choice); $i++) echo $choice[$i] . ", "; I know this may be very simple but my brain is not working correctly. when I use a similar code I only get the first letter of the value and if a user selects more that one choice I only get the first letter of the last choice.??? Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
revraz Posted December 8, 2007 Share Posted December 8, 2007 Type should be "radio" and not checkbox. If using Radios, you can use the same name since only one can be picked in a group. 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.