What is wrong with this script?

  1. #1
    dwaynecasey is offline Newbie

    What is wrong with this script?

    Learing PHP via online couse..but no one to bounce questions off of.
    when the form processes it goes to the email verification error even if their is a valid email input. I have had problems with any of the>> !$variable << doing the same thing


    Cheers!!


    <body>
    <?
    if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){
    ?>
    <H2>Whoops</H2>
    <BR>
    Please Enter a valid email adress.
    <A HREF="feedback.html">Click here to go back to the feedback page</A>
    <?
    exit;
    }

    $user = addslashes($user);
    $email = addslashes($email);
    $comments = addslashes($comments);
    $db = mysql_connect("localhost");
    mysql_select_db("vinyldealers", $db);
    $addfeedback = "INSERT INTO feedback(user, email, spam, comments)
    VALUES ('$user', '$email', '$spam', '$comments')";
    $result = mysql_query($addfeedback);
    ?>
    <H2>Thank You</H2>
    <BR>
    We have added your comments to our database.
    <A HREF="feedback.html">Click here to go back to the feedback page</A>



    </body>
    </html>


  2. #2
    waylandbill is offline Junior Member
    Did you try escaping the @ symbol in the regular expression test?

  3. #3
    kortex is offline Newbie
    Tackle the Web with $5.99 .COM's from Go Daddy!
    this:
    $db = mysql_connect("localhost");

    usually requires more parameters, specifically the user name and password for the database (at least if the database is mySQL)

+ Reply to Thread