Jump to content

rEhSi_123

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Everything posted by rEhSi_123

  1. Thanks rille95 and mikesta707 for the correction as I should have know this..... Also mikesta707 what do you mean by this 'you can also have the query execute in the else statement if you dont want to use exit' sorry
  2. 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!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.