1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Form Validation

Discussion in 'PHP' started by starr05, Sep 20, 2011.

  1. starr05

    starr05 New Member

    Joined:
    Sep 20, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I am new to php and I was suggested that I use form validation in my php, but I dont know how. Anyone willing to help?

    This is what I got so far that works:

    PHP:

    <?php
    $first_name
    =$_POST['name'];
    $email_address=$_POST['email'];
    $subject=$_POST['subject'];
    $message=$_POST['text'];

    mail("myemailaddres@gmail.com","Subject: $subject",
    $message,"From: $first_name <$email_address>");

    echo 
    "Thank you for using our mail form.<br/>";
    echo 
    "Your email has been sent.";
    ?>


     
  2. pein87

    pein87 New Member

    Joined:
    Aug 6, 2010
    Messages:
    173
    Likes Received:
    47
    Trophy Points:
    0
    Occupation:
    Web Dev
    Location:
    Limbo
    Basically you need to validate the data being send to the script. You can find a bunch of free validaters for text, email, phone numbers, ip etc...
     
  3. starr05

    starr05 New Member

    Joined:
    Sep 20, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Thanks! :happy:
     
  4. c_user

    c_user New Member

    Joined:
    Aug 23, 2009
    Messages:
    86
    Likes Received:
    8
    Trophy Points:
    0
    Occupation:
    Php dev
    Location:
    Bhubaneswar
    The above code sends an email to e-mail address provided by the user..
     
  5. raju_mars

    raju_mars New Member

    Joined:
    Apr 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    Your website user send mail to u....
     

Share This Page