PHP Quote form

Reply

Join Date: Apr 2007
Posts: 2
Reputation: HunterSThompson is an unknown quantity at this point 
Solved Threads: 0
HunterSThompson HunterSThompson is offline Offline
Newbie Poster

PHP Quote form

 
0
  #1
Apr 16th, 2007
im trying to make it so when someone hits submit and a feild is empty or blank i message pops up and says "must fill in required feilds" near the bottom of the form rather than having a new page open up and say it.
Last edited by HunterSThompson; Apr 16th, 2007 at 8:36 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 16
Reputation: WhiteLeo is an unknown quantity at this point 
Solved Threads: 2
WhiteLeo's Avatar
WhiteLeo WhiteLeo is offline Offline
Newbie Poster

Re: PHP Quote form

 
0
  #2
Apr 17th, 2007
I would suggest using Javascript to validate the form, and then once the form has been sent validate it again using php.

Javascript validation is easy, just google for "Javascript Form Validation" and pleanty of examples appear.

The reason you must validate again using Php is because user's can disable javascript, so you shouldn't rely on users browsers to validate the form. It makes it easier for users, but it shouldn't replace your normal validation.

http://www.w3schools.com/js/js_form_validation.asp
That's the example I learned off.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 187
Reputation: phper is an unknown quantity at this point 
Solved Threads: 15
phper's Avatar
phper phper is offline Offline
Junior Poster

Re: PHP Quote form

 
0
  #3
Apr 17th, 2007
The problem with using JavaScript is that the user can disable Javascript.

You could try using the strlen function.
If my post is useful please add to my reputation.
Thanks.

Ajtrichards Web Solutions | http://www.ajtrichards.co.uk
Retenovate | http://www.retenovate.com
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 16
Reputation: WhiteLeo is an unknown quantity at this point 
Solved Threads: 2
WhiteLeo's Avatar
WhiteLeo WhiteLeo is offline Offline
Newbie Poster

Re: PHP Quote form

 
0
  #4
Apr 17th, 2007
Originally Posted by phper View Post
The problem with using JavaScript is that the user can disable Javascript.

You could try using the strlen function.
Which is why I said the form should be validated a second time using php.

He wants the user to be informed on the same page without the page reloading, and you do that with javascript.

If the user hasn't got it enabled, then the php still validates the form.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC