Forums
This topic is locked
Allowing only one selection
Replies
Replied 12 Dec 2003 12:06:08
12 Dec 2003 12:06:08 goa103 goa103 replied:
Note : this topic should be moved to the HTML forum, it doesn't deal with PHP but HTML forms.
Use radio buttons instead of checkboxes. It only allows a visitor to pick one choice from many.
Radio example :
<pre id=code><font face=courier size=2 id=code>
<form action="my_action.php" method="POST">
<input type="radio" name="my_radio" value="0" checked> My default radio<br>
<input type="radio" name="my_radio" value="1"> My radio 1<br>
<input type="radio" name="my_radio" value="2"> My radio 2<br>
<input type="submit">
</form>
</font id=code></pre id=code>
Same example with checkboxes :
<pre id=code><font face=courier size=2 id=code>
<form action="my_action.php" method="POST">
<input type="checkbox" name="my_radio" value="0" checked> My default choice<br>
<input type="checkbox" name="my_radio" value="1"> My choice 1<br>
<input type="checkbox" name="my_radio" value="2"> My choice 2<br>
<input type="submit">
</form>
</font id=code></pre id=code>
Edited by - goa103 on 10 Nov 2008 00:25:16
Use radio buttons instead of checkboxes. It only allows a visitor to pick one choice from many.
Radio example :
<pre id=code><font face=courier size=2 id=code>
<form action="my_action.php" method="POST">
<input type="radio" name="my_radio" value="0" checked> My default radio<br>
<input type="radio" name="my_radio" value="1"> My radio 1<br>
<input type="radio" name="my_radio" value="2"> My radio 2<br>
<input type="submit">
</form>
</font id=code></pre id=code>
Same example with checkboxes :
<pre id=code><font face=courier size=2 id=code>
<form action="my_action.php" method="POST">
<input type="checkbox" name="my_radio" value="0" checked> My default choice<br>
<input type="checkbox" name="my_radio" value="1"> My choice 1<br>
<input type="checkbox" name="my_radio" value="2"> My choice 2<br>
<input type="submit">
</form>
</font id=code></pre id=code>
Edited by - goa103 on 10 Nov 2008 00:25:16