[SOLVED] struggling with "Contact Form"
Posted: Tue Oct 04, 2005 4:39 pm
Hello! I'm new to this forum. Since I took an advice to make dynamic webpages by adding PHP to them, I've gone through some PHP tutorials. But I'm currently puzzled with this PHP project: contact form.
Here's the portion of contactus.html:
and here's the sendmail.php code:
when I filled in the contact form and hit "submit" button, the screen went blank with "done" text in the status portion of the web browser. What have I done wrong?
Please enlighten me. 
Here's the portion of contactus.html:
Code: Select all
<FORM METHOD="post" ACTION="sendmail.php">
<input type=hidden name="required" value="Email,Name,Phone,Message ">
<table width="542" border="0" cellspacing="0" cellpadding="2">
<tr valign="top">
<td width="57" height="26" valign="middle">
<div align="left">Name:</div></td>
<td width="194"> <div align="left">
<label for="Name"></label>
<input name="Name" type="text" id="name2" size="25" />
</div></td>
<td width="77" rowspan="5"><div align="center">Message<br />
or Question:
</div>
<label for="label"></label></td>
<td width="300" rowspan="5"><textarea input name="Message" id="message2" cols="60" rows="5">
</textarea></td>
</tr>
<tr valign="top">
<td height="26" valign="middle">
<div align="left">
<label for="Phone">Phone:</label>
</div></td>
<td> <div align="left">
<input name="Phone" type="text" id="phone2" size="25" />
</div></td>
</tr>
<tr valign="top">
<td valign="middle">
<div align="left">
<label for="Fax">Fax:</label>
</div></td>
<td> <div align="left">
<input name="Fax" type="text" id="fax2" size="25" />
</div></td>
</tr>
<tr valign="top">
<td valign="middle">
<div align="left">
<label for="Email">Email:</label>
</div></td>
<td> <div align="left">
<input name="Email" type="text" id="email2" size="25" />
</div></td>
</tr>
<tr valign="top">
<td colspan="2" rowspan="2"> <div align="left"></div>
<div align="left"><br />
</div></td>
</tr>
<tr valign="top">
<td> </td>
<td halign="left"><input type="submit" name="Submit" value="Submit" id="Submit2" />
<input type="reset" name="Reset" value="Reset" id="Reset2" /> </td>
</tr>
</table>
</form></div>Code: Select all
<?php
$Name = $_REQUEST['Name'] ;
$Email = $_REQUEST['Email'] ;
$Message = $_REQUEST['Message'] ;
$Phone = $_REQUEST['Phone'] ;
$Fax = $_REQUEST['Fax'] ;
if (!isset($_REQUEST['Email'])) {
header( "Location: http://www.cacvrs.org/contactus.html" );
}
elseif (empty($Email) || empty($Message)) {
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
<html>
<head><title>Error Message</title></head>
<body>
<h1>Error!</h1>
<p>
Oops, it appears you forgot to enter your
email address and your message. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
else {
mail( "tgalofre@cacdhh.org", "Email Form Submission",
$Message, "From: $Email" );
header( "Location: http://www.cacvrs.org/thankyou.html" );
}
?>