I am just starting to learn a little about PHP; having trouble with the following code using IF || to check multiple statments from a form. here is my code; can someone give me some pointers?
<html>
<body>
<?php
if (((($_POST['first_name']== null) || ($_POST['last_name']== null) || ($_POST['email']== null) || ($_POST['comments']== null)))) {
echo "Error one or more fields have been left empty please complete all details marked with a *.";}
else {
echo $_POST['first_name']; <br />
echo $_POST['last_name']; <br />
echo $_POST['email']; <br />
echo $_POST['telephone']; <br />
echo $_POST['comments']; <br />
}
?>
</body>
</html>
You may be better off with:
You can customise the error messages, of course, and maybe do some stuff like highlight the boxes that were left empty to allow the user to see more clearly what they missed.