Help with a PHP email form?

RIKI

New member
I am trying to create a php to email the contents of a form to me. I currently do not have access to a php server, and I am hoping to use this in my parents business' website so I would like to know if there are any improvements needed to this code. Any help will be appreciated.

<?php
$fname = $_POST["fullname"] ;
$addr = $_POST["address"] ;
$email = $_POST["email"] ;
$phone = $_POST["phone"] ;
$mobil = $_POST["mobile"] ;
$date = $_POST["date"] ;
$bugt = $_POST["budget"] ;
$deliv = $_POST["delivery"] ;
$flav = $_POST["flavour"] ;
$des = $_POST["design"] ;
$agr = $_POST["agree"] ;

if($email==''") {print "You have not entered an email, please go back and try again";}
else {
if($fname=='"') {print "You have not entered a name, please go back and try again";}
else {
if($addr=='"') {print "You have not entered a last name, please go back and try again";}
else {
if($phone==''") {print "You have not entered a phone number, please go back and try again";}
else {
if($date==''") {print "You have not entered a date, please go back and try again";}
else {
if($bugt==''") {print "You have not entered a budget, please go back and try again";}
else {
if($deliv==''") {print "You have not entered delivery details, please go back and try again";}
else {
if($flav=='"') {print "You have not entered a flavour, please go back and try again";}
else {
if($des==''") {print "You have not entered a design, please go back and try again";}
else {
if($agr==''") {print "You have not agreed to the terms and conditions, please go back and try again";}
else {

$to = '[email protected]' ;
$from = '$fname' ;
$subject = "Web Contact Data";

$body = "Automated cake order:
Full name: $fname
Address: $addr
Email: $email
Phone: $phone
Mobile: $mobil
Date: $date
Budget: $bugt
Delivery details: $deliv
Flavour: $flav
Design: $des";

$autoreply = "Thank you for contacting us. We will reply with your information within 48 hours.";

if(mail($to, $from, $subject, $body)) {
header( "Location: sent.html" );
} else {
echo ("Thanks for showing your interest. However, we encountered an error sending your mail, please notify [email protected] from your email client");
}
}
}
}
}
}
}
}
}
}
}
?>
 
Back
Top