Jump to content

Deckarduk

Members
  • Posts

    3
  • Joined

  • Last visited

Deckarduk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Otuatail. Thanks for your reply. The basic requirement at present is simply to check whether there's an entry for each field at all, before sending the message, rather than checking a given address itself exists. Any help you can offer would be great though. Sam
  2. Hi guys, I'm sure this is pretty straight forward, but I have very limited PHP experience. Can someone please let me know the best way to add validation to the following contact form?: <?php $EmailTo = "email@domain.com"; $Subject = "Website Contact Page"; $EmailFrom = Trim(stripslashes($_POST['Name'])); $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Website = Trim(stripslashes($_POST['Website'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; 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 .= "Email: "; $Body .= $Email; $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=thanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Any help greatly appreciated. Thanks in advance.
×
×
  • 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.