944,196 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4484
  • PHP RSS
Apr 16th, 2007
0

PHP Quote form

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
HunterSThompson is offline Offline
2 posts
since Apr 2007
Apr 17th, 2007
0

Re: PHP Quote form

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.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
WhiteLeo is offline Offline
16 posts
since Feb 2007
Apr 17th, 2007
0

Re: PHP Quote form

The problem with using JavaScript is that the user can disable Javascript.

You could try using the strlen function.
Reputation Points: 15
Solved Threads: 17
Junior Poster
phper is offline Offline
189 posts
since Nov 2006
Apr 17th, 2007
0

Re: PHP Quote form

Click to Expand / Collapse  Quote originally posted by phper ...
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.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
WhiteLeo is offline Offline
16 posts
since Feb 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: get html element value using php
Next Thread in PHP Forum Timeline: mysql_fetch_array random problem?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC