An HTML form (say: form.php) sends the following fields:
Code: Select all
$rname=$_POST['rname'];
$rmobile=$_POST['rmobile'];
$rarea=$_POST['rarea'];
$remail=$_POST['remail'];
Before I insert these fields into the sql database, here's what i want to do:
- 1) Check if all 5 fields are filled
2) Check if rmobile is a ten digit number
3) Check if email is in the proper format
If they validate, the php code should trim and sanitize the data before inserting into the SQL database.
Please help me with the php code for the validation/ trimming and sanitization part.
I have been pulling my hair on this one
PLs Pls Pls get me out of this