ASSIGNMENT 5 Basic Perl CGI Forms operations Due: Tuesday, Mar. 4, 11:59:59 pm Document status: DRAFT (Last update: 2/25/08) 1. Write a CGI script that detects the HTTP_USER_AGENT and the REMOTE_ADDR from the server environment. Your script should produce a simple HTML page indicating whether the user logged on to the page is using either Mozilla/Netscape, FireFox or Internet Explorer. (Suggestion: Use a simple regular expression match that tests whether the user-agent includes the string 'MSIE'. If not, we assume it's Netscape/Mozilla. You may decide to handle other browsers as well, but this is not a requirement.) (25 pts.) 2. Hidden Fields (25 pts.) Create a cgi script that uses a hidden form field to pass user-supplied data across html pages. The user should be presented with an HTML form page with a field to enter a name and submit button. On submit, another form page must be called up to enter more data of your choice. A text input field and a submit button would suffice. This second form page must contain the name entered into the previous form as a hidden field. The submit button shall call up a third page that will display the data entered in both previous form pages, including the name. Thus, there are three separate web pages required. The pages must be created dynamically by cgi-scripts using CGI.pm functions. 3. Server-side Validation (50 pts.) Create a cgi script that validates form data that will eventually be sent to "the server" for whatever purposes it might be used. This is to be via an elaboration of the HTML form pages created for problem 2. They must check that required data has been submitted and whether the data is of the right kind, as specified below. Required data are: first name (must not be empty), last name (must not be empty), address (must not be empty), city (must not be empty), state (must be a string of two letters, save in upper case), zip (must be a string of five digits), email (a string that must contain one '@' and at least one '.') area of expertise (at least one recognized choice* must have been submitted) (* A 'recognized choice' is one of the alternative values given on your form page.) If one or more data fields do not meet the requirements, the form and data must be returned to the user with a message indicating the problem. With the exception of radio and checkbox fields, valid data must appear in the corresponding form fields so the user does not have to enter it again. Finally, when the data has been validated and found correct, the user must be notified about the acceptance of the data on another HTML page. That is, this last task must send its information to a separate form page that generates a new web page reporting the collected information. Again there are three separate web pages required.