Posts: 159
Location: Skegness, Lincolnshire, England
|
I have run both scripts through my server, tweaked a couple of things, used my own email address (put yours back in now though), and it worked for me. The only suggestion I have with regard to it not sending mail is that your host may have the PHP mail function disabled, so check with them.
The two pages (that work) are as follows:
orderform.php
Code:
<?php
$err = $_GET['err'];
if (!$err) { $err = 0; }
?>
<html>
<head>
<style type="text/css">
input.text {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
textarea {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
</style>
</head>
<body style="scrollbar-base-color: 73BDBD; scrollbar-track-color: white; scrollbar-face-color: white; scrollbar-highlight-color: white; scrollbar-3dlight-color: 73BDBD; scrollbar-darkshadow-color: white; scrollbar-shadow-color: 73BDBD; scrollbar-arrow-color: black;">
<?php
if ($err != 0) { echo "<span style='color:red'>The email address you entered did not conform to recognized standards.</span><br>"; }
?>
<form method="post" action="thanks.php">
First name:<br><input type="text" name="fname" class="text"><br>
Last name:<br><input type="text" name="lname" class="text"><br>
Email:<br><input type="text" name="email" class="text"><br>
Address:<br><input type="text" name="address" class="text"><br>
Apt. #:<br><input type="text" name="aptnum" class="text"><br>
City:<br><input type="text" name="city" class="text"><br>
State:<br><input type="text" name="state" class="text"><br>
Zip code:<br><input type="text" name="zip" class="text"><br>
Country:<br><input type="text" name="country" class="text"><br><br>
Means of payment:<br>
<input type="checkbox" name="check" value="check">Check<br>
<input type="checkbox" name="moneyorder" value="moneyorder">Money Order<br>
(choose only one)<br><br>
Items wanted (list full item name):<br><textarea name="question_text" rows="5" cols="50"></textarea><br><br>
<center>Before you submit please double check your information.<br>
<input type="submit" value="submit" style="font-size:8pt; font-family: verdana;"></center>
</form>
</body>
</html>
thanks.php
Code:
<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $email)) {
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/orderform.php?err=1");
}
$address = $_POST['address'];
$aptnum = $_POST['aptnum'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$check = $_POST['check'];
if (!$check) { $check = "No"; } else { $check = "Yes"; }
$moneyorder = $_POST['moneyorder'];
if (!$moneyorder) { $moneyorder = "No"; } else { $moneyorder = "Yes"; }
$text = $_POST['question_text'];
$to = "ilovetheused5374@yahoo.com";
$subject = "Results from online form";
$message = "First name: ".$fname."\nLast Name: ".$lname."\nEmail: ".$email."\nAddress: ".$address."\nApt# :".$aptnum."\nCity: ".$city."\nZip: ".$zip."\nCountry :".$country."\nPayment : Check - ".$check." or Moneyorder - ".$moneyorder."\nQuery: ".$text."\n";
$headers = "From: OnlineForm <ilovetheused5374@yahoo.com>\n";
mail($to, $subject, $message, $headers);
?>
<html>
<head>
</head>
<body>
<font face="verdana">
<b>Thank you for your purchase!!</b><br><br>
You will receive an email shortly.
</font>
</body>
</html>
I hope that sorts you out 
|