Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

A little PHP script help...

  • 09-05-2011 05: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