Ok im in the process of writing my new site. Im moving away from my existing Joomla setup to a purely HTML/CSS based site (more for speed and the fact im fed up of the bloat that you get with Joomla).
Now, im trying to write in a simple Contact Us form, and at the moment im using the following:
On page code:
and i have the following code in the contact.php file:
But when i enter information in all of the fields and click submit, it takes me to the client login page at scenter.com and i gat a mail delivery failiure in the sending contact's inbox.
Can anyone give me any pointers on what i am am doing wrong (i can't see why it isn't working haha)
Now, im trying to write in a simple Contact Us form, and at the moment im using the following:
On page code:
Code:
<form method="POST" action="contact.php"> Fields marked (*) are required <p>Email From:* <br> <input type="text" name="EmailFrom"> <p>Name:<br> <input type="text" name="Name"> <p>Telephone:<br> <input type="text" name="Telephone"> <p>Message:<br> <textarea name="Message"></textarea> <p><input type="submit" name="submit" value="Submit"> </form>
Code:
<?php // get posted data into local variables $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "sales@**********.com"; $Subject = "You have a query from your site."; $Name = Trim(stripslashes($_POST['Name'])); $Address = Trim(stripslashes($_POST['Address'])); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?>
Can anyone give me any pointers on what i am am doing wrong (i can't see why it isn't working haha)
Comment