Jump to content

Recommended Posts

Hi,

 

I've got a form which is set for bookings, The user fills in the form and then gets their details cascaded on the next page, Giving them the option of confirming wether there information is correct or not

 

if the user confirms their details, I'd like it to then E-Mail the person who deals with the bookings

 

At the moment I've got the page to broadcast itself as in the FORM ACTION = "bookings.php"

 

What I'd like to know is the best way for the user to confirm this booking or the best way to tidy up my damn code ???

 

Here is the code :

 

<?php #RLSmith Skip Booking Check & Confirmation Script by Stuart Blackett (stuartblackett@googlemail.com)

// Collect Post Vars

// Customer Details
$typeofuse = $_POST['typeofuse'];
$contactname = $_POST['contactname'];
$companyname = $_POST['companyname'];
$companyposition = $_POST['companyposition'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$town = $_POST['town'];
$postcode = $_POST['postcode'];
$mobile = $_POST['mobile'];
$telephone = $_POST['telephone'];
$fax = $_POST['fax'];
$email = $_POST['email'];

// Delivery Details
$deliverydate = $_POST['deliverydate'];
$deliveryaddress = $_POST['deliveryaddress1'];
$deliveryaddress2 = $_POST['deliveryaddress2'];
$deliverytown = $_POST['deliverytown'];
$deliverypostcode = $_POST['deliverypostcode'];

// Skip Details
$skipsize = $_POST['skipsize'];
$wastetype = $_POST['wastetype'];
$skiplocation = $_POST['skiplocation'];
$additionalinfo = $_POST['additionalinfo'];

// Echo out the Data



echo "Thank You, you entered : ";

// First the Contact Details

echo "<h1> Contact Details </h1>";
echo $contactname;
echo "<br>";
echo $companyposition;
echo "<br>";
echo "Address : $address1 $address2 $town $postcode";
echo "<br><br>";
echo "Telephone Details : $mobile $telephone $fax";
echo $email;

// Next the Delivery address

echo "<h1> Delivery Details </h1>";
echo "Delivery date : $deliverydate"; 
echo "<br><br>";
echo "Delivery address : $deliveryaddress $deliveryaddress2 $deliverytown $deliverypostcode";  

// Skip Details

echo "<h1> Skip Details </h1>";
echo "Skip Size : $skipsize";
echo "<br><br>";
echo "Waste Type : $wastetype";
echo "<br><br>";
echo "Skip Location : $skiplocation";
echo "<br><br>";
echo "Additional Information : $additionalinfo";

echo "<br><br>";

echo "<form action='skip-booking.php' method='post'>";
echo "<input type='submit' name='Submit' value='Confirm'/>";
echo "</form>";

if (isset ($_POST['Submit'])) {
ini_set("sendmail_from", " $email ");
//$to = "bookings@alnwicklodge.com";
$to = "stuartblackett@fantasyprints.co.uk";
$subject = "RL Smith Skip Booking";

$messagesent = "New Skip Booking
-------------------------------------------------------------------------------------------------------------------------------------------------------------
You have a new skip booking  

Contact Details.....

$contactname;

$companyposition;

Address : $address1 $address2 $town $postcode;

Telephone Details : $mobile $telephone $fax;

E-Mail : $email;

Delivery Details.....

Delivery address : $deliveryaddress $deliveryaddress2 $deliverytown $deliverypostcode;  

Delivery date : $deliverydate; 

Skip Details....;

Skip Size : $skipsize;
Waste Type : $wastetype;

Skip Location : $skiplocation;

Additional Information : $additionalinfo;

DO NOT REPLY TO THIS MESSAGE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
";

$from = $_POST["email"];
$headers = "Message From: $from";
mail($to,$subject,$messagesent,$headers);
header(location:thankyou.html);

}

?>

Link to comment
https://forums.phpfreaks.com/topic/119486-help-with-if-statements/
Share on other sites

I'm now getting the PHP Error

 

Warning: mail() [function.mail]: SMTP server response: 554 <******@*****.com>: Recipient address rejected: Relay access denied in E:\domains\f\fpwebdesign.com\user\htdocs\test\skip-booking.php on line 120

 

I've ***'ed the E-Mail address out

 

 

EDIT**

 

I'm receiving the E-Mails but there are undefined variable errors after confirming

 

How do I, After all thats been sent send the user to a thankyou page

 

I'm trying

header("location: LINK"); exit();

 

Straight after the script but its actually executing before the submit button is pressed

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.