| | |
PHP: Form Validation
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2006
Posts: 14
Reputation:
Solved Threads: 0
Hey there all. I wanted to know if there was a way to use php to validate form.
Well in more detail, I wanted to know if it was possible to print a msgbox using php telling the user he has missed some thing rather than having to display a new page. Also I don't want to use javascript if possible. Would like to thank in advance.
Well in more detail, I wanted to know if it was possible to print a msgbox using php telling the user he has missed some thing rather than having to display a new page. Also I don't want to use javascript if possible. Would like to thank in advance.
Of course there is. This is basic PHP. Have you tried to write code for this yet?
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Hi,
Whats so bad in displaying the form again? If a input field is empty, you just give it a value like value="Please fill out this field". I think most sites do it like that, and message boxes without JavaScript are hardly possible.
Michael
Whats so bad in displaying the form again? If a input field is empty, you just give it a value like value="Please fill out this field". I think most sites do it like that, and message boxes without JavaScript are hardly possible.
Michael
•
•
Join Date: Sep 2006
Posts: 44
Reputation:
Solved Threads: 3
If you wanted to use php functions to do the validation (say against database entries and such), then you might want to consider using an ajax library such as xajax, and make it look spiffy using something like scriptaculous (ok, maybe I'm going overboard, but it can be very slick). I've used that to validate form fields against a database, and point out where issues might exist.
But, you can't really get away from javascript, if you don't want the page to reload. PHP is a server side language, meaning that once the form is rendered and sent to the browser, there's NO link with the server again until you submit back (or use ajax like stuff).
Personally, I prefer just doing client-side javascript validation, as its easier to point out to the user where errors lie. That's not to say that you don't need to revalidate once you hit php, as the javascript side is easily forgeable.
But, you can't really get away from javascript, if you don't want the page to reload. PHP is a server side language, meaning that once the form is rendered and sent to the browser, there's NO link with the server again until you submit back (or use ajax like stuff).
Personally, I prefer just doing client-side javascript validation, as its easier to point out to the user where errors lie. That's not to say that you don't need to revalidate once you hit php, as the javascript side is easily forgeable.
•
•
Join Date: Jul 2009
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Hey there all. I wanted to know if there was a way to use php to validate form.
Well in more detail, I wanted to know if it was possible to print a msgbox using php telling the user he has missed some thing rather than having to display a new page. Also I don't want to use javascript if possible. Would like to thank in advance.
![]() |
Similar Threads
- PHP Form Validation ??? (PHP)
- Sending pic attachments via PHP form (PHP)
- Online voting (PHP)
Other Threads in the PHP Forum
- Previous Thread: PHP Messaging System
- Next Thread: Need directions in improving PHP & MySQL skills
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






