I have a form which uses a php validation for sending an email (both email and telephone number are validated) and it works beautifully. However when something is 'sent' or the mail 'fails' or something is 'invalid' I am currently redirecting to a new page.
What I'd like is for the messages I display on redirect to simply show up under the form. So my form submits to my php file which validates everything then instead of refreshing the pages and then redirecting for the message 'Mail sent' or 'Mail failed' they just show up underneath. And also for 'Invalid email or phone number' to display also.
I've looked around at javascript validation, but I'm not 100% sure on how to get what I want done with it. I'd like to start with the validation error message.
If someone would be kind enough to point me in the direction of a good site about this I'd be greatful, as it stands I'm just confusing myself looking at so many!
Thanks kindly,
Aravona
form validation
Moderator: General Moderators
-
rahulzatakia
- Forum Commoner
- Posts: 59
- Joined: Fri Feb 05, 2010 12:01 am
- Location: Ahmedabad
Re: form validation
You can use the session handling to display error/message for form validation through PHP.
Re: form validation
using javascript for form validation, you can validate the form before it is submitted via php. i'm currently using jQuery to handle this.
using php for form validation, the form has to be submitted in order for php to validate the values.
using php with ajax, the form can be validated as data is being entered and before the form is submitted
using php for form validation, the form has to be submitted in order for php to validate the values.
using php with ajax, the form can be validated as data is being entered and before the form is submitted