Question: I need to add form validation for all the user inputs in the fieldnames. I have the HTML and part of the PHP code. Thank

I need to add form validation for all the user inputs in the fieldnames. I have the HTML and part of the PHP code. Thank you in advance.

dog_rescue.html :

Dog Rescue

********************************************

process_dog_rescue.php :

if(isset($_POST["submitButton"]))

{

//getting details entered by user

$fName=$_POST['fName'];//firstName

$lName=$_POST['lName'];//lastName

$email=$_POST['email'];//email

$dogName=$_POST['dogName'];//dogName

//php function to check dog availability

function IsDogAvailable($dogName)

{

//checking dogName

if($dogName=="Abby" || $dogName=="Mari")

{

//if dog is either Abby or Mari then they are not available

echo "Thank you for filling out the dog rescue form ".$GLOBALS['fName']." ".$GLOBALS['lName'].".Unfortunately ".$dogName." is no longer available for adoption.";

}

else{

//if dog is not Abby or Mari then they are available

echo "Thank you for filling out the dog rescue form ".$GLOBALS['fName']." ".$GLOBALS['lName'].".".$dogName." still available for adoption. We'll contact you shortly.";

}

}

//call function and pass dogName

IsDogAvailable($dogName);

}

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!