Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Need to require either one or another option be completed in form

$
0
0

I'm not sure how to write a little snippet of php code.  The form is at http://medicallakeveterinaryclinic.com/schedule.html.  At the bottom, it asks them to put either their phone number of email address.  I have a php script that checks to make sure they completed all the fields (see below).  I don't know how to write an "or" line of code ($email_text OR $phone_text).  Help!

 

___________

$first_name = $_REQUEST['first_name'] ;
$last_name = $_REQUEST['last_name'] ;
$pet = $_REQUEST['pet'] ;
$species = $_REQUEST['species'] ;
$dog = $_REQUEST['dog'] ;
$cat = $_REQUEST['cat'] ;
$other = $_REQUEST['other'] ;
$other_species = $_REQUEST['other_species'] ;
$date = $_REQUEST['date'] ;
$time = $_REQUEST['time'] ;
$reason = $_REQUEST['reason'] ;
$contact = $_REQUEST['contact'] ;
$email = $_REQUEST['email'] ;
$email_text = $_REQUEST['email_text'};
$phone = $_REQUEST['phone'] ;
$phone_text = $_REQUEST['phone_text'};

$all=
"first_name: ".$first_name."\r\n".
"last_name: ".$last_name."\r\n".
"pet: ".$pet."\r\n".
"species: ".$species."\r\n".
"other_species: ".$other_species."\r\n".
"date: ".$date."\r\n".
"time: ".$time."\r\n".
"reason: ".$reason."\r\n".
"contact: ".$contact."\r\n".
"email: ".$email."\r\n".
"email_text: ".$email_text."\r\n".
"phone: ".$phone."\r\n";
"phone_text: ".$phone_text."\r\n";

}

// If the form fields are empty, redirect to the error page.
elseif (empty($first_name) || empty($last_name) ||empty($species) ||empty($date)|| empty($time)|| empty($reason) || empty($contact)) {
header( "Location: $error_page" );
}
 


Viewing all articles
Browse latest Browse all 13200

Trending Articles