Zend - The PHP Company




Forms

Add Code


radio button selecter  

Type: code fragment
Added by: deathray
Entered: 06/08/2004
Last modified: 08/12/2003
Rating: - (fewer than 3 votes)
Views: 6223
This is a simple way to set and get values from a readio button or drop down box. Less code than other methods.


PHP RADIO BUTTON TRICK:
User:<input type="radio" name="userlevel" <? If ($userlevel == "User") { ?>
checked <? }?> value="User">
Admin:<input type="radio" name="userlevel" <? If ($userlevel == "Admin") {
?> checked <? }?> value="Admin">

SAME THING FOR PHP DROP DOWN BOX TRICK:
<select size="1" name="clientstyleday" value="<?=$clientstyleday?>"
ID="suf">
<option <?php if ($clientstyleday == "Daily") { ?> selected<?php }?>
value="Daily">Daily</option>
<option <?php if ($clientstyleday == "Weekly") { ?>selected<?php }?>
value="Weekly">Weekly</option>
</select>


Usage Example




Rate This Script





Search



This Category All Categories