You are tasked with writing client-side and server-side code to validate and process form data. The HTML form has the following structure: " server.php " id=" my_form "> Name: Age: Phone: Part A....

1 answer below »

You are tasked with writing client-side and server-side code to validate and process form data. The HTML form has the following structure:




































































Part A. JavaScript / jQuery


Write JavaScript / jQuery code to validate the form data before submission to the server. You must ensure each field adheres to the following criteria:



  • Name: length must be between 3 and 90 characters (inclusive).

  • Age: must be a number between 1 and 120 (inclusive).

  • Phone: must be a number and exactly 10-digits in length and start with ‘04’


If all validation criteria is met, the form data must be sent to the server using an AJAX POST request. Output an appropriate console message if the AJAX request fails. [8 marks]



Part B. PHP


Write PHP code to receive, process, and respond to the request made from the JavaScript / jQuery code you wrote for Part A. Validation of the data should be performed, using the same criteria as Part A. If validation is passed, write the data to a text file. Correct HTTP responses must be given. [8 marks]



Answered Same DaySep 29, 2022

Answer To: You are tasked with writing client-side and server-side code to validate and process form data. The...

Robert answered on Sep 29 2022
52 Votes
YOUR PART A CODE IS
data.html






Document