stublackett Posted August 13, 2008 Share Posted August 13, 2008 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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/ Share on other sites More sharing options...
ignace Posted August 13, 2008 Share Posted August 13, 2008 if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'GET') { // HTTP POST } Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/#findComment-615536 Share on other sites More sharing options...
stublackett Posted August 13, 2008 Author Share Posted August 13, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/#findComment-615546 Share on other sites More sharing options...
DarkWater Posted August 13, 2008 Share Posted August 13, 2008 This isn't a real header: $headers = "Message From: $from"; Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/#findComment-615548 Share on other sites More sharing options...
stublackett Posted August 13, 2008 Author Share Posted August 13, 2008 This isn't a real header: $headers = "Message From: $from"; If thats the case, Whats the best way to send an E-Mail ??? Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/#findComment-615551 Share on other sites More sharing options...
DarkWater Posted August 13, 2008 Share Posted August 13, 2008 This isn't a real header: $headers = "Message From: $from"; If thats the case, Whats the best way to send an E-Mail ??? The header SHOULD be: $headers = "From: $from"; Not Message From. Quote Link to comment https://forums.phpfreaks.com/topic/119486-help-with-if-statements/#findComment-615553 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.