Question
Objectives: To acquaint you with PHP file handling, HTML forms, arrays, strings, and control structures. Tasks: You will write a web application that helps user
Objectives: To acquaint you with PHP file handling, HTML forms, arrays, strings, and control structures.
Tasks: You will write a web application that helps user create a profile. A user profile contains users first name, last name, email, gender, education, programming skills, research information, and a profile photo. The application uses a web form to allow a user to enter and submit information and upload a profile photo. It then processes user input and displays user profile information and photo on a new page. You are expected to create two files: hw2_form.php and hw2_process.php. The assignment must meet the following specifications:
1) The file hw2_form.php generates a webpage as shown in Figure 1. The page uses various input types to allow user to enter and submit personal information and allows user to upload a profile photo. After user submits the form, hw2_process.php sanitizes user input, displays the users profile information and photo on a web page as shown in Figure 5.
2) The First Name, Last Name, and Email information use text fields and each input is required (see Figure 2).
3) The Gender information uses radio buttons to allow a single selection from two options: Male and Female. The input is required.
4) The Education information uses a drop-down list and allows a single selection from six options: Doctorate, ABD, Masters Degree, Bachelors Degree, Associates Degree, and Other. The default selection is Doctorate.
5) The Programming Skills information uses checkboxes to allow zero to multiple selections from seven options: Java, C/C++, Python, PHP, JavaScript, SQL, and Kotlin. This input is optional. If the user doesnt select anything, display You did not enter any programing skill information (see Figure 3). The input of checkboxes must be stored in a php array, not multiple php variables.
6) The Research Interest information uses a Text Area to allow multiple-line input and is optional to the user. If the user doesnt enter anything, display You did not enter research information (see Figure 3).
7) The time, day of the week, and date information when the profile is created should be displayed in the format as shown in Figure 5.
8) The form has a file input to allow user to browse the computer and select a file to upload. If the user doesnt upload a file, the webpage displays No file has been uploaded (see Figure 3). If the image file is not a JPG, GIF, PNG or TIF file, the webpage displays the filename and displays that the file is not an accepted file (see Figure 4). Please see hints.
9) The form has a Submit button to submit form data and a Reset button to clear up the form data (see Figure 1).
10) The input entered by the user from text fields and text area (not from a list of predefined options) must be sanitized. These include input for first name, last name, email, and research information. Please see hints.
11) Use a fieldset to display BCS350 Assignment 2 - your name on the top of both web pages. You are free to decide the style of your pages. Good work in page styling will earn extra credits. in php
1. The hw2_form.php has one HTML form that contains multiple input types.
2. Use HTML input required attribute https://www.w3schools.com/tags/att_input_required.asp
3. Use the php empty function to check if an input field is empty or not empty. For example, if (!empty($research)) echo $research; http://php.net/manual/en/function.empty.php
4. Use HTML table or
tag to format web content.
https://www.w3schools.com/html/html_tables.asp
5. Use the date_default_timezone_set function to set the time zone.
6. Use if ($_FILES['filename']['error']==0) to check whether a file is uploaded or not.
7. Chapter 7 has good examples (such as, 7.15 and 7.16) for file uploading and filename type checking.
8. Use the php function htmlentities to sanitize user input. For example,
$var = htmlentities($var)
Step 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