Hi,
I have the following code which is loaded when a form is submitted
<?php
if ($submit) {
if (!$run || !$arrive_time) { echo'Please fill in all fields'; } else { DO form processing }
} ?>
But when I enter blank run and arrive_time fields, it doesnt print the error message! Please help!
Laura.
If you want to check for empty strings, you should do just that:
if ($var != '')
if you do
if ($var) you are checking to see if $var was set, and if you fill out an empty field, it is set, it's just empty...
Indeed.
I'd also suggest doing your form verification client side, as it is quicker, and more user friendly.
It's also unreliable :-)
Instead of using
<b>if (!$run || !$arrive_time) </b>
trying using
<b>((!$run)||(!$arrive_time))</b>
Hope that helps,
Di