Redirect to html after form is submitted
Posted: Sun Apr 19, 2009 8:03 am
Hi I hope someone out there can help me.
In an attempt to drag our companies web facilities into the 21st centuary i am starting to create many forms which when submitted email the details to a specified email adress etc. I have sucseeded to a point by following advice both from this site and following online tutorials.
Where i have a problem is that i want to redirect the customer to an html after they have submitted the form. I have acheived the redirection and a thankyou html appears which is great however i have a GIF and some links on this thankyou html, ie a link back to the home page once the customer has read my blurb but the gif and links do not work!!!
Is this because this just isn't possible or do i need to re-write my code. I am very new to PHP but my existing code is as follows............
<?php
/*subject and Email Variables */
$emailSubject = 'Campervan Van Form';
$webMaster = 'my@email';
/* Gathering Data Variables */
$titleField = $_POST['title'];
$nameField = $_POST['name'];
$addressField = $_POST['address'];
$telephoneField = $_POST['telephone'];
$emailField = $_POST['email'];
$campervanreg = $_POST['campervanreg'];
$arrivaldate = $_POST['arrivaldate'];
$noofnights = $_POST['noofnights'];
$noonboard = $_POST['noonboard'];
$total = $_POST['total'];
$comments = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
Title: $title <br>
Name: $name <br>
Address: $address <br>
Telephone No: $telephone <br>
Email Address: $email <br>
Campervan registration: $campervanreg <br>
Arrival Date: $arrivaldate <br>
No of Nights: $noofnights <br>
No of People on Board: $noonboard <br>
Overall Cost: $total <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
THIS IS WHERE I JUST COPY AND PASTE MY HTML CODE WHICH CONTAINS THE GIF AND LINK
</html>
EOD;
echo "$theResults";
is there a much simpler way of redirecting someone to an html of my choice once they have submitted the form or is there something i am doing wrong which makes the GIF not appear or the link work??
I dont need the PHP to validate my form as this is done via spy validation widgets before the form in submitted as i wish to keep it all as simple as possible.
Any help with re-writing the above would be much appreciated and im sure it is very simple but its beaten me.
Many thanks in advance
In an attempt to drag our companies web facilities into the 21st centuary i am starting to create many forms which when submitted email the details to a specified email adress etc. I have sucseeded to a point by following advice both from this site and following online tutorials.
Where i have a problem is that i want to redirect the customer to an html after they have submitted the form. I have acheived the redirection and a thankyou html appears which is great however i have a GIF and some links on this thankyou html, ie a link back to the home page once the customer has read my blurb but the gif and links do not work!!!
Is this because this just isn't possible or do i need to re-write my code. I am very new to PHP but my existing code is as follows............
<?php
/*subject and Email Variables */
$emailSubject = 'Campervan Van Form';
$webMaster = 'my@email';
/* Gathering Data Variables */
$titleField = $_POST['title'];
$nameField = $_POST['name'];
$addressField = $_POST['address'];
$telephoneField = $_POST['telephone'];
$emailField = $_POST['email'];
$campervanreg = $_POST['campervanreg'];
$arrivaldate = $_POST['arrivaldate'];
$noofnights = $_POST['noofnights'];
$noonboard = $_POST['noonboard'];
$total = $_POST['total'];
$comments = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
Title: $title <br>
Name: $name <br>
Address: $address <br>
Telephone No: $telephone <br>
Email Address: $email <br>
Campervan registration: $campervanreg <br>
Arrival Date: $arrivaldate <br>
No of Nights: $noofnights <br>
No of People on Board: $noonboard <br>
Overall Cost: $total <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
THIS IS WHERE I JUST COPY AND PASTE MY HTML CODE WHICH CONTAINS THE GIF AND LINK
</html>
EOD;
echo "$theResults";
is there a much simpler way of redirecting someone to an html of my choice once they have submitted the form or is there something i am doing wrong which makes the GIF not appear or the link work??
I dont need the PHP to validate my form as this is done via spy validation widgets before the form in submitted as i wish to keep it all as simple as possible.
Any help with re-writing the above would be much appreciated and im sure it is very simple but its beaten me.
Many thanks in advance