Results 1 to 2 of 2

Thread: Form help

  1. #1
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Form help

    here is what I have...


    PHP Code:
    <?php
    function checkOK($field)
    {
    if (
    eregi("\r",$field) || eregi("\n",$field)){
    die(
    "Invalid Input!");
    };

    $type $_POST['type'];
    checkOK($type);
    $comments $_POST['comments'];
    checkOK($comments);
    $email $_POST['email'];
    checkOK($email);
    $to="smrpgx@gmail.com";
    $message="A visitor with the IP address $REMOTE_ADDR has sent an email from Rave Games. He/She said:\n$comments\n\nHis/Her email address is $email";
    if(
    mail($to,"Visitor feedback: $type",$message,"From: $email\n")) {
    echo 
    "Thanks for your comments.";
    } else {
    echo 
    "There was a problem sending the mail. Please check that you filled in the form correctly.";
    }
    ?>

    Can anyone tell me what I am doing wrong?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Apart from the fact that it's $_SERVER['HTTP_REMOTE_ADDR'] not $REMOTE_ADDR, not too much, at a quick glance. Fancy giving us a hint? The error(s) you get, maybe?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •