need mainly the php file and how to do the \"value\" portion
use pregmatch to verify proper format in the php file ifable.
Create an HTML form that will accept four fields: first name,last name, user ID, and values. Name this file userInfo.html. Thereshould be a submit and reset button on your html form. Yourinput fields for your form should be inside of a table. Thesubmit button should send the data to a php file namedupdateInfo.php. The updateInfo.php file should check the datasubmitted by the html file for proper formatting. While it isallowable that you may check input on the client side(either HTML or Javascript), you MUSTcheck for valid input on the server using PHP. (It will be easierto test your code if you don’t bother doing any checks on the HTMLside – you will have to disable the checks on your own code to testthe bad inputs).
***IMPORTANT***
Your POST variables in your HTML file must be labeled asfollows. I have written an automated script to run tests on yourcode, and it depends on the POST variables being labeled correctlywithin the HTML Form.
- \"first_name\"
- \"last_name\"
- \"user_id\"
- \"values\"
The following rules must be enforced by your PHP script aboutthe input.
- No field is allowed to be blank.
- Maximum length of first and last name is 20 characters.
- The first and last names should be only made up of alphabeticalcharacters. (no numbers or symbols). Only a-z, and A-Z. Anyordering of lower/uppercase letters is acceptable.
- User ID must be 3 lowercase letters followed by 3 numbers.Example: abc123
- Values has a max length of 50 characters. It is a commaseparated list of values, with each value in the range 0.0 to100.0.
- Every value must have 1 digit afterthe decimal point.
- Every value must have 1,2, or 3digits before the decimal point (i.e. .7 is not avalid value in our system, but 0.7is valid).
- Here is an example of input to the values field:
9.3,100.0,45.5,43.0,0.7,0.0,76.9,1.0Â Â
If any field has invalid data, display an error message and alink back to the userInfo.html page. Do not writeinvalid data to the text file, or to the html table.Ignore all data when an entry is invalid.
If all the fields are valid, your PHP script should save thedata into a file named userInfo.txt which should have the followingformat and be sorted by “last_nameâ€. (Note you will need to read inthe existing file’s data and add the new data to your datastructure, and sort it before you can write the new file in theproper order). Put each record on its own line. To simplify things,you can assume that Last Names are unique – i.e. you can use thelast name as a key for your associative array. (I won’t use two ofthe same last name when I test your code).
LastName--FirstName--UserID--Min,Max,Average;\n
Here is a sample record (a single line) of what should be inyour text file:
Doe--John--abc123--3.4,99.9,45.4;
You can see from this that you will need to process the inputvalues from the user to determine the min value, the max value, andthe average. To be clear, you don’t need to store all the valuesentered, just the minimum, the maximum, and the average.
Once the new data has been received, you should also display ALLdata from the text file into an HTML table. The table should besorted by last name just like the text file. After successfullydisplaying your table, create a link back to the userInfo.htmlpage. You should have 6 columns in your HTML file, with anappropriate header for each column.