Hello,
I am new at php email forms. I know I must have the coding wrong either in the html or php (most likely the php). When I test out the form, it goes to the thankyou.html page were i would then think the data would get sent to an email but it is not...
<form action="feedback.php" method="post">
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr>
<td width="118">Full Name:</td><td width="362"><input type="text" name="name" size="25" /></td></tr>
<tr><td height="56">Email address:</td>
<td><input type="text" name="email" size="25" /></td></tr>
<tr>
<td height="56">Street Address:</td>
<td><input type="text" name="address" size="25" /></td></tr>
<tr>
<td height="56">City/State/Zip:</td>
<td><input type="text" name="city" size="25" /></td></tr>
<tr>
<td colspan="2"><p class="style14">Please select items </strong>
<table width="554" border="0" cellpadding="4">
<tr>
<th width="240" height="240" scope="col"><div align="left">Chocolate Sin Cake (mini)
<input type="checkbox" name="cake1" value="choco" />
<br />
Chocolate Peanut Butter (mini)
<input type="checkbox" name="cake2" value="pb" />
Chocolate Mint (mini)
<input type="checkbox" name="cake3" value="mint" />
<br />
Coconut (mini)
<input type="checkbox" name="cake4" value="coconut" />
<br />
Strawberry (mini)
<input type="checkbox" name="cake5" value="straw" />
<br />
Banana (mini)
<input type="checkbox" name="cake6" value="banana" />
<br />
Lemon (mini)
<input type="checkbox" name="cake7" value="lemon" />
</div></th>
<th width="292" scope="col"><div align="left"><strong>Classic Apple Pie </strong>
<input type="checkbox" name="cake8" value="apple" />
<br />
<strong>Classic New York Cheesecake </strong>
<input type="checkbox" name="cake9" value="nycheese" />
<br />
<strong>Pumpkin Cheesecake with Gingersnap Crust </strong>
<input type="checkbox" name="cake10" value="pimpkin" />
<br />
<strong>Classic German Chocolate Cake
<input type="checkbox" name="cake11" value="german" />
<br>
Classic Carrot Cake</strong>
<input type="checkbox" name="cake12" value="carrot" />
<br />
<strong>Lemon Sin Cake </strong>
<input type="checkbox" name="cake13" value="lemon big" />
<br />
<strong>Chocolate Peanut Butter Sin </strong>
<input type="checkbox" name="cake14" value="pb big" />
<br />
<strong>Chocolate Sin Cake </strong>
<input type="checkbox" name="cake15" value="choco big" />
</div></th>
</tr>
</table>
<p> <span class="style14">Select how many days from today to pick-up</span>:
<select name="days2">
<option value="3">3 days</option>
<option value="4">4 days</option>
<option value="5">5 days</option>
<option value="6">6 days</option>
<option value="7">Week from today</option>
</select>
<br>
<em>*Cakes only available for pick-up during business hours</em> </td>
</tr>
<tr>
<td align="center" colspan="2"><p class="style14">
Additional Comments/Instructions
<p class="style14">
<textarea rows="15" cols="45" name="comments"></textarea>
<br />
<br />
</td>
</tr>
<tr>
<td height="37" colspan="2" align="center"><p class="style14">
<input type="submit" value="Send Order" />
</td>
</tr>
</table>
</form>
<?php
// ------------- CONFIGURABLE SECTION ------------------------
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com" ;
$mailto = 'jackie@reallycookingcafe.com' ;
// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;
$subject = "CAKE ORDER" ;
// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;
$formurl = "http://www.reallycookingcafe.com/feedback.html" ;
$errorurl = "http://www.reallycookingcafe.com/error.html" ;
$thankyouurl = "http://www.reallycookingcafe.com/thankyou.html" ;
$uself = 0;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.08" );
header( "Location: $thankyouurl" );
exit ;
?>
[ ModEdit - bpat1434 ] Please use BBCode when posting code or HTML. It makes things so much nicer 🙂