Click to See Complete Forum and Search --> : php validation


Jaime1985
09-16-2005, 03:53 AM
Hi everyone,

I'm looking to use php validation with the forms on my website.
I need it to be fairly dynamic so that if the user submits a form and he/she enters something invalid the user is made aware of it in the same page.
An example of the sort of validation I'd like to achieve http://www.caspio.com/signup/trial.asp < just insert some dodgy data.

Are there any tutorials on this subject? I've looked far and wide on google but most of them are very basic or they use javascript.

Thanks for any help

James

Sheldon
09-16-2005, 03:56 AM
search the forum before posting as there is many threads on php and javascript validation

Sheldon
09-16-2005, 04:27 AM
Sorry i shouldnt have been so harsh,

here is a quick example in php of what can do in php

When you submit the page use something like this

<?php if(empty($_POST['name'] ||$_POST['email'] ||$_POST['comments'])){ // names from the form feild
print 'error go back';
// if you want to go back to the orignal form with messages like that i would use a session or hidden feilds to pass back the orignal data sent and the error message to print
}else{
//sendmail script or whatever you need to do
}
?>

Jaime1985
09-16-2005, 05:34 AM
Thx Sheldon:), I'm still looking into this. I found a post by NogDog with a reference to one his php form validators...looks really neat.
Apart from the that, I havent found any descriptive tutorials on the subject of php form validation :(