Trouble with my form validation. Would appreciate your help

Discussion in 'JavaScript' started by pictureboarduk, Feb 18, 2009.

  1. #1
    Hi,

    I am trying to validate my contactus form using an external JavaScript script, but also wish to use PHP to send the form to my site's email address.

    Can these two technologies work together?

    I'm a little unsure.

    Many thanks!
     
    pictureboarduk, Feb 18, 2009 IP
  2. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Of course you can use both.

    Javascript runs on the client (in the browser) and will validate the user input before allowing the submit.

    PHP works on the server and will receive the submitted form and use the data to send the email..

    However, you should also validate the user input on the PHP code, because someone without javascript enabled will be able to post un-validated data.. (unvalidated from javascript..)

    hope this helps
     
    gnp, Feb 18, 2009 IP
    pictureboarduk likes this.