i have html forms want validate using php. i've been told should validate them posting them separate php file, rather including php code in html document (as save source, amend php validation able input anything).
pointers on validating following great:
- form have letters , numbers
- date form correct format (dd/mm/yyyy)
- form not blank
if correct, proceed add these database.
however, having validation outside of html itself, how give error message highlighting form had data in incorrect form?
you'll want create whats called sticky form.
you'll need create php file instead of regular html-only file behaves differently if responding post rather request.
validations can exist in same file form. you'll need use php functions , regular expressions perform validations on post parameters.
if post passes validation continue, otherwise re-render form errors highlighted.
benefit of doing way opposed separate php script user shouldnt presented entirely blank form if 1 out of many fields fails validation.
----------
oh , php source should never show in browser. gets parsed html before leaving server.
Forums Special Interests Web Design and Development
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
Comments
Post a Comment