> I know this might be a bit easy for all you experts out
> there. I have multiple checkboxes and text areas in a form. In the
> confirmation email sent to the user I manage to get the text areas to
display
> in the email. How would I get the results of the checkboxes to to
display as well?
Here is a page I wrote to explore form processing. It has a simple form
on it that includes each type of form element (except file upload) and
displays back all input. It can also be used as a form target and it
will tell you what form elements were submitted.
It was written some time ago and I haven't updated it for the latest
version of PHP so it will most likely require register_globals to be on.
-----8<-----
<html>
<head>
<title>OQI - CGI Reflector</title>
</head>
<body bgcolor="#F5F5F5" text="#000000" link="#000099" vlink="#6600CC">
<?
if ($HTTP_POST_VARS)
{
echo "<h1 align=\"center\"><font face=\"Arial,Helvetica\">CGI
Reflector</font></h1>\n";
echo "<center><font face=\"Arial,Helvetica\" size=2>\n";
echo "Here are the results of the form that you have just
submitted:\n";
echo "</font></center>\n";
echo "<center><table width=500 border=0 cellspacing=5
cellpadding=5>\n";
echo "<tr>\n";
echo "<th align=center width=200 bgcolor=\"#D0DCE0\">\n";
echo "<font face=\"Arial,Helvetica\" size=2>Form Input
Name</font>\n";
echo "</th><th align=center width=300 bgcolor=\"#D0DCE0\">\n";
echo "<font face=\"Arial,Helvetica\" size=2>Form Input
Data</font>\n";
echo "</th>\n";
echo "</tr>\n";
while(list($key, $val) = each($HTTP_POST_VARS))
{
echo "<tr>\n";
echo "<td align=center width=200 bgcolor=\"#D0DCE0\">\n";
echo "<font face=\"Arial,Helvetica\" size=2>$key</font>\n";
echo "</td><td align=center width=300 bgcolor=\"#D0DCE0\">\n";
if (is_array($val))
{
while(list($sval) = each($val))
{
echo "<font face=\"Arial,Helvetica\"
size=2>$sval<br></font>\n";
}
} else {
echo "<font face=\"Arial,Helvetica\" size=2>$val</font>\n";
}
echo "</td>\n";
echo "</tr>\n";
}
echo "</table></center>\n";
} else {
echo "<h1 align=\"center\"><font face=\"Arial,Helvetica\">CGI
Reflector</font></h1>\n";
?>
<form name="FormExample" action="<?=$PHP_SELF?>" method="post">
<center><table width=500 border=0 bgcolor="D0DCE0" cellpadding=5
cellspacing=0>
<tr>
<td width=500 align=center colspan=2 bgcolor="#E5E5E5">
<font face="Arial,Helvetica" size=3>Test Form</font>
</td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Text</font>
</th><td width=300 align=left>
<input type="text" name="TextInput" value="Text Input Text"
size=30 maxlength=50>
</td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Select</font>
</th><td width=300 align=left>
<select name="SelectInput">
<option value="1" selected>First Option</option>
<option value="2">Second Option</option>
<option value="3">Third Option</option>
</select>
</td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Multi-Select</font>
</th><td width=300 align=left>
<select name="MultiSelect[]" size=3 multiple>
<option value="1">First Option</option>
<option value="2">Second Option</option>
<option value="3">Third Option</option>
<option value="4">Fourth Option</option>
<option value="5">Fifth Option</option>
</select>
</td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Check Box</font>
</th><td width=300 align=left><font face="Arial,Helvetica"
size=2>
<input type="checkbox" name="CheckBox1" value="1">Check Box
1<br>
<input type="checkbox" name="CheckBox2" value="2">Check Box
2
</font></td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Radio Button</font>
</th><td width=300 align=left><font face="Arial,Helvetica"
size=2>
<input type="radio" name="RadioButton" value="1">Radio
Button 1<br>
<input type="radio" name="RadioButton" value="2">Radio
Button 2
</font></td>
</tr><tr>
<th width=200 align=right bgcolor="D0D0D0">
<font face="Arial,Helvetica" size=2>Text Area</font>
</th><td width=300 align=left><font face="Arial,Helvetica"
size=2>
<textarea name="TextArea" width=30 rows=4>Default
Text</textarea>
</font></td>
</tr><tr>
<td width=500 align=center colspan=2 bgcolor="#E5E5E5">
<input type="submit" name="Submit" value="Submit Form">
<input type="reset" name="Reset" value="Reset Form">
</td>
</tr>
</table></center>
</form>
<?
}
?>
</body>
</html>
----8<-----
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php