Question
Please fix the code below: 1. index.php 2. Page1.php Personal Information Personal Information Name:
Please fix the code below:
1. index.php
//Define data $name = ''; $age = ''; $email = ''; $error = ''; $level = ''; $page = ''; $list = array(); //$applicantStr = ''; //$action = ''; //$program = array();
if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') === 'POST') { $name = filter_input(INPUT_POST, 'name'); if(empty($name)){ $error = "The name field should not be empty. "; } else { $list[0] = $name; } $age = filter_input(INPUT_POST, 'age'); if(empty($age) || filter_var($age, FILTER_VALIDATE_INT) === FALSE){ $error .= "The age field should not be empty and must be an integer. "; } else { $list[1] = $age; } $email = filter_input(INPUT_POST, 'email'); if(empty($email) || filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE){ $error .= "The email address field is invalid. "; }else { $list[2] = $email; } $level = filter_input(INPUT_POST, 'level'); $page = filter_input(INPUT_POST, 'page'); //$program = isset($_POST['programs[]']); }
switch($page){ case 'Page2': if(empty($error)){ include 'Page2.php'; } else { include 'Page1.php'; echo $error; } break; case 'Page3': if($level === 'undergraduate'){ include 'Page3b.php'; } elseif($level === 'graduate'){ include 'Page3.php'; } break; case 'Page4': include 'Page4.php'; break; default: include 'Page1.php'; exit(0); } ?>
2. Page1.php
Personal Information
3. Page2.php
Degree Level
3. Page3.php
Graduate Degree Programs
4. Page3b.php
Undergraduate Degree Programs
5. Page4.php
Final Page
- 0 X Page1.php X Personal Information - QupZilla Elle Edit View History Bookmarks Tools Help Personal information X + C e tp://ocalhost admission Qupila Git OupZilla Wii P CupZilla Issues DuckDuckGo CupZilla Blog OupZilla Home Personal Information Name: Peter Age: 22 Email Address: peter@yahoo.com Page 2 localhost (127001) Page2.php X Degree Level - QupZilla Eile Edit View History Bookmarks Tools Help Degree Level X + C t tp:/localhost'admission/index.php Oupilla Git OupZilla Wii QupZilla issues - DuckDuckGo QupZilla Blog QupZilla Home Degree Level Select your color: Under Graduate Graduate Page1 Page 3 localhost (127.0.0.1) - 0 x X Graduate Degree Programs - QupZilla Eile Edit View History Bookmarks Tools Help Graduate Degree Programs X + C http:/localhost/admission/index.php QupZilla Git OupZilla Wiki QupZilla Issues - DuckDuckGo QupZilla Blog QupZilla Home Graduate Degree Programs Select your program(s): MSCS MBA Page2 Page4 localhost (127.0.0.1) O Page3.php Undergraduate Degree Programs - QupZilla File Edit View History Bookmarks Tools Help Undergraduate Degree Programs X + C http://localhost/admission/index.php QupZilla Git QupZilla Wiki CupZilla Issues 4 - - DuckDuckGo CupZilla Blog QupZilla Home Undergraduate Degree Programs Select your program(s): BSCS BBA Page2 Page 4 localhost (127.0.0.1) Page3b.php - 0 x X Final Page - QupZilla File Edit View History Bookmarks Tools Help Final Page X + C http://localhost'admission/index.php QupZilla Git QupZilla Wiki QupZilla Issues 6 DuckDuckGo W CupZilla Home CupZilla Blog Final Page You have entered the following information: Fleld Value Name Peter Age 22 peter@yahoo.com Degree Level graduate Programs mscs Page3 Reset localhost (127.0.0.10 Page4.phpStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started