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:>
You already use trim() on the insert, why not call it once in the beginning, and test that value?
trim()
$user_address = trim($_POST['address']); if (empty($user_address)) { $msg = 'You must enter an address' ; } else { $address = mysqli_real_escape_string($dbc, strip_tags($user_address)) ; }