Hello Everbody
I am have php website in which I have decided to add Testimonial section where visitors can leave feedbacks...etc....
Everything seems to be working fine where I am able to enter the data into the MySQL database.
Anyways, basically I am trying to add a required field validator in order to prevent an empty form to be submitted into the database i.e. blank fields.
I googled the above topic where I have come across Javascript validators ...etc but I want to stay away from it because of very less experience and since there is a possibility of browers with no javascript support.
I have also tried the below:
if ($_POST['name']=="") {
Print("Please fill in all fields!<br>");
}
elseif ($_POST['email']=="")
{
Print("Please fill in all fields!!<br>");
}
elseif ($_POST['comment']=="")
{
Print("Please fill in all fields!!!<br>");
}
else
{
echo "Successful";
echo "<BR>";
echo "<a href='viewguestbook.php'>View guestbook</a>";
}
Where it displays a error message if the field is empty but blank data is still entered into the database
Any suggestions please advice!