I have come to the conclusion that my web hosts php interpreter is a bit quirky....i think.
Basically, i have the script working now and functioning correctly after hours of writing, re-writing etc etc....
Here is the completed (working) php code....
Code: Select all
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$name = $_REQUEST['name'] ;
$string = "Name: ".$_POST['name']."\n";
$string .= "E-Mail: ".$_POST['email']."\n";
$string .= "Message: ".$_POST['message'];
if (!isset($_REQUEST['email'])) {
header( "Location: http://www.thanweb.co.uk/contactus.html" );
}
elseif (empty($email) || empty($message) || empty($name)) {
header( "Location: http://www.thanweb.co.uk/error.html" );
}
else {
mail("root@thanweb.co.uk", "Website Request Form", $string, "Your website contact form has been used...", "-froot@thanweb.co.uk");
header( "Location: http://www.thanweb.co.uk/thankyou.html" );
}
?>Lets say for example i wanted to alter the way in which the content is formatted in the email being sent. If i change the $string variable here ($string = "Name: ".$_POST['name']."\n";) to also include the word 'Your' i would then proceed to alter htis snippet of code to be ($string = "Your Name: ".$_POST['name']."\n";). To me this seems logical and should present no problems???
Obviously not.....by me adding this one piece of text to the string it completely stops the script from working..
So now you can see why it took me so long to create this code as my web hosts php interpreter is very strange indeed and i had to keep writing it until it decided it was happy with my input..
Is it just me or is that very strange indeed??
Everah | Please use the proper bbCode tags when posting code in the forums. You can use [code], [php] for PHP code, [{LANG}] or [syntax="{LANG}"] (where {LANG} is the lowercase name of the language you want to highlight with) to highlight code blocks.