I have a enrollment form where users have to input there address. I am using PHP for validation and currently I check to make sure the field is not empty. Here is my code:>
if($_POST['submit']){
$address = $_POST['address'];
if (empty($address)) {
echo "You must enter an address";
} else {
$address = mysqli_real_escape_string($dbc, strip_tags($user_address)) ;
}
}
You can echo immediately the message if the field address is empty
also the $_POST['submit']
is to determine if the user click the submit button