joefox
Sep 27th, 2006, 04:47 PM
Simple error...
I just wanted to make a simple program that gets data from one form and sends it to the next..but i get a weird error.
I can pass values if i type in a value, but not if i have a check box, or a drop down box.
Entry form
<form action="/php/handle_form.php" method="post">
<fieldset>Enter your information:
<p><b>Name:</b><input type="text" name="name" size="20" maxlenght="40" /></p>
<p><b>Model:</b><input type="text" name="model" size="20" maxlenght="20" /></p>
<p><b>Model Information:</b>
<input type ="radio" name="status" value="New" /> New
<input type ="radio" name="status" value="Old" /> Old</p>
<p><b>Year:</b>
<select name="year">
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
</select></p>
<p><b>Model Comments:</b> <textarea name="comments" rows="3" cols="40"></textarea></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Enter" />
</form></div></p>
handler form:
<?php
$name = $_REQUEST['name'];
$model = $_REQUEST['model'];
$comments = $_REQUEST['comments'];
$_REQUEST['status'];
$_REQUEST['year'];
$_REQUEST['submit'];
echo "<b>Action:</b><br>";
//Print the submitted information
echo "<b>$name</b>, has entered $model $year for the following comments:<p>$comments";
?>
I get this error...
Action:
Notice: Undefined variable: year in C:\Inetpub\jf1\php\handle_form.php on line 20
Joe Fox, has entered MCV7745 for the following comments:
Here is a test for Commetns
I just wanted to make a simple program that gets data from one form and sends it to the next..but i get a weird error.
I can pass values if i type in a value, but not if i have a check box, or a drop down box.
Entry form
<form action="/php/handle_form.php" method="post">
<fieldset>Enter your information:
<p><b>Name:</b><input type="text" name="name" size="20" maxlenght="40" /></p>
<p><b>Model:</b><input type="text" name="model" size="20" maxlenght="20" /></p>
<p><b>Model Information:</b>
<input type ="radio" name="status" value="New" /> New
<input type ="radio" name="status" value="Old" /> Old</p>
<p><b>Year:</b>
<select name="year">
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
</select></p>
<p><b>Model Comments:</b> <textarea name="comments" rows="3" cols="40"></textarea></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Enter" />
</form></div></p>
handler form:
<?php
$name = $_REQUEST['name'];
$model = $_REQUEST['model'];
$comments = $_REQUEST['comments'];
$_REQUEST['status'];
$_REQUEST['year'];
$_REQUEST['submit'];
echo "<b>Action:</b><br>";
//Print the submitted information
echo "<b>$name</b>, has entered $model $year for the following comments:<p>$comments";
?>
I get this error...
Action:
Notice: Undefined variable: year in C:\Inetpub\jf1\php\handle_form.php on line 20
Joe Fox, has entered MCV7745 for the following comments:
Here is a test for Commetns