w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Making an RSVP form.. How do I make required fields not required based on dropdown?

Check if either $friday or $saturday are given then do the check for meal. If both are not entered then there will not be a check for meal

if($first_name =='') { $errors .= "first_name,"; }
if($last_name =='') { $errors .= "last_name,"; }
if(valid_email($rsvp_email)==FALSE) { $errors .= "rsvp_email,"; }
if($friday =='') { $errors .= "friday,"; }
if($saturday =='') { $errors .= "saturday,"; }
if( $friday != '' || $saturday != '') {
   if($meal_choice =='') { $errors .= "meal_choice,"; }
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.