How to finish off a Form post with validation?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jordan t
    New Member
    • Dec 2010
    • 1

    How to finish off a Form post with validation?

    Hi, i have been having trouble finding a tutorial on how to add validation to a form in php and having been pulling my hair out trying to work it out if you could help me i would be so gratefull!

    Example

    This will be the default value for one of the fields
    Name: "Enter Your Name Here"

    I would like to make it so that if
    A) "Enter Your Name Here" or any other spam such as email injection to result in a error message.
    B) The field has to be filled in

    Also if its not to much to ask how could i validate a phone number field and a email address field.
    Attached Files
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    1. Validation on server side
    2. Validation on Client side

    you are talking about Validation on server side. In validation on server side you can get all the values Using $_GET or $_POST (depending on your form Method).

    But If you want to validate your form before submit i.e. number 2. You must have to do it with Javascript. Simply by browsing all the element in the form you can decide to submit or not submit.

    Comment

    Working...