Post an eg of php validation form | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Post an eg of php validation form

6th Dec 2017, 2:03 AM
Deepanshu Banyal
Deepanshu Banyal - avatar
2 Answers
+ 4
Many ways to do this. Most php frameworks (laravel or codeigniter) have form validation baked into it so you don’t have to reinvent the wheel. One way to make you own validation is to make a variable called $errors =0; check the post for what you want required if(! Isset($_POST[‘name’]){$error = 1; $message[] = ‘name field is required’; Then at the end look to see if error is 1 and return the error message to the view. There’s a million different alternatives. Just google it.
6th Dec 2017, 2:27 AM
Parker Dell
Parker Dell - avatar
+ 1
give me a full example
8th Dec 2017, 2:03 AM
Deepanshu Banyal
Deepanshu Banyal - avatar