Question: Set up a form to submit to itself Use an if - else structure Use a switch structure Preparing to do work Fork and clone.

Set up a form to submit to itself
Use an if-else structure
Use a switch structure
Preparing to do work
Fork and clone. Follow the steps outlined in Assignment 1(except use the launchers on this assignment)
Note: you don't need to generate your ssh keys and assign them again. You only had to do that once which you did on Assignment 1.
Description
We'll be a building an app to find out more details of Pac 12 universities
We'll be building a form that accepts a name of a university (in two versions) and then returning the mascot and enrollment for searched university.
Two possibilities of each university is acceptable as the name. Here's a list of acceptable names:
Utah or UT
Arizona or AZ
Arizona State or ASU
California or UC
UCLA or University of California LA
Colorado or University of Colorado
Oregon or UO
Oregon State or OSU
USC or Southern California
Stanford or Stanford University
Washington or UW
Washington State or WSU
Thus, if someone enters Utah or UT then a mascot of Utes and the enrollment of 33000 is returned.
Use this image for reference to the enrollment and mascots
Screenshot 2023-04-26 at 8.15.33 AM.png
Specifications
Open the terminal window
Change directory using the cd command to the directory that you cloned for the assignment.
Enter git checkout -b assignment/selection at the command line prompt to create an assignment branch
Create a file called selection.php
Use an HTML template with a PHP block in the body tags and title of Selection
Assure $name, $mascot, and $enrollment are declared with initial empty values
Setup a form that submits to itself using POST
The form will have a name field and a submit button
After form is submitted use if-else structure to determine and assign $mascot
Use a switch statement on the $mascot to then determine and assign the $enrollment
In the PHP block that resides in the body tags, if $name has a value output: School is: where name is bold
In the PHP block that resides in the body tags, if $mascot has a value output: Mascot is and it is bold
In the PHP block that resides in the body tags, if $enrollment has a value output: Enrollment is: in bold
If no name is recognized then output a message saying: School not found
If no name is entered then output a message saying: No name entered
Below is a demonstration of desired outcome (no audio):
Hint:
If you follow this pattern then it should get you pretty far. Basically, initialize your variables but don't assign them until you know the form has been submitted (re: $_POST).
$name ='';
$mascot ='';
$enrollment =-1;
$submitted = false;
if (isset($_POST['submit'])){
...
Assignment Submission
Enter git add --all at the command line prompt to add the files or changes to the repository
Enter git status to see the changes to be committed
Enter git commit -m 'Selection Assignment complete' at the command line to commit new files/changes
Enter git push origin assignment/selection to push the changes to Gitlab

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!