Form Validation

starr05's Avatar, Join Date: Sep 2011
Newbie Member
I am new to php and I was suggested that I use form validation in my php, but I dont know how. Anyone willing to help?

This is what I got so far that works:

PHP Code:

<?php
$first_name
=$_POST['name'];
$email_address=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['text'];

mail("myemailaddres@gmail.com","Subject: $subject",
$message,"From: $first_name <$email_address>");

echo 
"Thank you for using our mail form.<br/>";
echo 
"Your email has been sent.";
?>
pein87's Avatar
Ambitious contributor
Basically you need to validate the data being send to the script. You can find a bunch of free validaters for text, email, phone numbers, ip etc...
starr05's Avatar, Join Date: Sep 2011
Newbie Member
Thanks!
c_user's Avatar, Join Date: Aug 2009
Contributor
The above code sends an email to e-mail address provided by the user..
raju_mars's Avatar, Join Date: Apr 2010
Light Poster
Your website user send mail to u....