Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Good news everyone! The Boards.ie Subscription service is live. See here: https://subscriptions.boards.ie/

A little PHP script help...

  • 09-05-2011 06:04PM
    #1
    Registered Users, Registered Users 2 Posts: 10,240 ✭✭✭✭


    I'm new to PHP and I've run into a little problem with a basic contact form. It was working OK but for whatever reason it now isn't returning any information from the comments section. Any ideas?
    <?php
    
    $name = Trim(stripslashes($_POST['name']));
    $email = Trim(stripslashes($_POST['email']));
    $address = Trim(stripslashes($_POST['address']));
    $comments = Trim(stripslashes($_POST['comments']));
    $EmailTo = "somebody@me.com";
    $Subject = "website contact";
    $validationOK=true;
    if(Trim($name)=="") $validationOK=false;
    if(Trim($email)=="") $validationOK=false;
    if (!$validationOK){
    	print "<meta http-equiv=\"refresh\" content=\"0;URL=fail.html\">";
    	exit;
    }
    $Body = "";
    $Body .= "Succesful message from:";
    $Body .= "\n";
    $Body .= $name;
    $Body .= "\n";
    $Body .= $email;
    $Body .= "\n";
    $Body .= $address;
    $Body .= "\n";
    $Body .= $comments;
    $Body .= "\n";
    $success = mail($EmailTo, $Subject, $Body);
    if($success){
    	print "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">";
    }
    else {
    	print "<meta http-equiv=\"refresh\" content=\"0;URL=fail.html\">";
    }
    ?>
    


Comments

  • Registered Users, Registered Users 2 Posts: 10,240 ✭✭✭✭Fanny Cradock


    This is sorted! The HTML wasn't matching the script. comment =/= comments. :o


Advertisement