Re: Radio Buttons

From: Date: Sun, 07 Jan 2001 17:37:06 +0000
Subject: Re: Radio Buttons
Groups: php.install 
Request: Send a blank email to php-install+get-1491@lists.php.net to get a copy of this message
>Hello everyone, >I'm wondering what the best way to store values from a set of radio buttons >is? > >I'm working part of an employee website where employee reviews are handled. >Most questions will have a set of radio buttons for each questions, with the >choices of either "Needs Improvement", "Meets Standard", or "Exceeds >Standard". I guess I could store them with numbers, 0, 1, or 2. I'm just >wondering when I need to edit an employee's review, how do you go about >displaying the correctly check radio button based on what the database >stores. here is a simple one, nothing special at all. But it will work. You can even put the whole thing into a function to make less code, i only included the simple one here. <HTML><HEAD> <TITLE>Untitled</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> ... database loading stuff ... <FORM ACTION="" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"> ... other form stuff ... <?php echo "<INPUT NAME=\"preformance\" TYPE=\"radio\" VALUE=\"0\""; if ($your_database_performance_value == 0) { echo " CHECKED>\n"; } else { echo ">\n"; } echo "<INPUT NAME=\"preformance\" TYPE=\"radio\" VALUE=\"1\""; if ($your_database_performance_value == 1) { echo " CHECKED>\n"; } else { echo ">\n"; } echo "<INPUT NAME=\"preformance\" TYPE=\"radio\" VALUE=\"2\""; if ($your_database_performance_value == 2) { echo " CHECKED>\n"; } else { echo ">\n"; } ?> ... all other stuff ... </FORM> </BODY> </HTML> -- Oceanbay Internet Services WebSite Design / Database / PHP sales@oceanbay.com Custom Solutions www.oceanbay.com Shockwave / Quicktime / VR

« previous php.install (#1491) next »