View Full Version : Radio/Dropdown Fields

11-22-2008, 12:36 AM
I am making a form where i need the user to select one of two radio buttons, enter some text fields and select info from a drop down box. I know how to put the text fields into a database, but im not sure how to put in the radio button value, and the drop-down box value.
The below code is what i have to add the text fields.

if ($HTTP_POST_VARS['submit']) {
$query ="INSERT INTO weblog (entrytitle,entrytext,entrytime)";
$query.=" VALUES ('$entrytitle','$entrytext', '$entrytime')";
if ($result) echo "<b>Successfully Posted!</b>";
else echo"ERROR";

<p><a href="index.php">Click Here to View</a></p>

Any help is greatly appreciated. THanks.

11-24-2008, 05:16 PM
For select box, see the examples in the page:
select box in a PHP form (http://www.html-form-guide.com/php-form/php-form-select.html)

For radio,
HTML sample:

<input type="radio" group="membership_type" value="Free">
<input type="radio" group="membership_type" value="Normal">
<input type="radio" group="membership_type" value="Deluxe">

PHP handling

$type = $_POST['membership_type'];