Question
Part 1: (SIMPLE) Write the necessary PHP code to calculate the total salary according to the following equation: Total Salary = Basic Salary + Martial
Part 1: (SIMPLE) Write the necessary PHP code to calculate the total salary according to the following equation: Total Salary = Basic Salary + Martial Status Allowance + Extra Tasks Allowance if Any Examine the following HTML code that describes how the form will submit the required input data. Note the following requirements and details: BD 50 is paid as an allowance for single status employee and BD 100 is paid for married. Assume the number of extra tasks are unknown. Extra allowances are part of checkboxes values. The form is submitted to the same program. The output should follow the sample screen shown below using ordered and unordered lists. Your program shouldnt display extras in case the user didnt choose any of the extra tasks options.
Sample Screens The form Looks LikeOutput: When the form is submitted
Part 2: (Moderate) Extend Part 1 by adding another question as Save this details with a checkbox. If the checkbox is ticked and the Calculate Salary is clicked, the details (total salary, extras, date and time) should be stored in one cookie that expires in 1 week. This cookie should be able to store history of the salary calculations in one cookie. The cookie name should be historyDetails and its values should be an array structure of your choice. Note that the cookie value is always string, to store an array inside the cookie, use serialize() or json_encode() and then store it in the cookie. To convert the cookie value to its original array structure, use unserialize( ) or json_decode(). Refer to php.net for examples. Tip: The array should be able to hold unknown number of salary calculations with its details. Example: you might use the following nested arrays (numeric and associative) to push new details in cookie value: $details[Total] = 1500 $details[Extras][ ] = Work on Weekend; //use loop $details[Extras][ ] = Work Abroad; $details[Date] = 6 March 2021; //use date function $details[Time] = 16:07:11; //use date function $cookieValue[ ] =$details; setcookie(historyDetails, json_encode($cookieValue), ); Dont overwrite, Be careful, before adding details, you need to retrieve all the previous details from the cookie and add the new calculations to the array and save it back too cookie. Part 3: (Moderate) Add another submit button near Calculate Salary with a caption View History. Once clicked, all salary calculations details that were stored in a cookie should be displayed in an HTML table of your own design.
Sir, Please solve and let me know the solution as soon as possible. It's urgent.
Thank You
Sample Screens The form Looks Like Output: When the form is submitted . . Salary Details: Total Salary is BD 1500 Extras: 1. Work on Weekend 2. Work Abroad Basic Salary 800 Marital Status: O Single O Married Extra: Work on Weekend - BD 200 Work Night Shift - BD 100 Work Abroad - BD 400 Calculate Salary Sample Screens The form Looks Like Output: When the form is submitted . . Salary Details: Total Salary is BD 1500 Extras: 1. Work on Weekend 2. Work Abroad Basic Salary 800 Marital Status: O Single O Married Extra: Work on Weekend - BD 200 Work Night Shift - BD 100 Work Abroad - BD 400 Calculate SalaryStep 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