Question: Basic Salary Marital Status: Single Married Extra: Work on Weekend - BD 200 Work Night Shift - BD 100 Work Abroad - BD 400 Part

 Basic Salary Marital Status: Single Married Extra: Work on Weekend -BD 200 Work Night Shift - BD 100 Work Abroad - BD

Basic Salary
Marital Status:
Single
Married
Extra:
Work on Weekend - BD 200
Work Night Shift - BD 100
Work Abroad - BD 400

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 it's 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 it's 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 $cookie Value[ ] =$details; setcookie(history Details, json_encode($cookie Value), ......); Don't 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. .

Basic Salary
Marital Status:
Single
Married
Extra:
Work on Weekend - BD 200
Work Night Shift - BD 100
Work Abroad - BD 400

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 it's 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 it's 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 $cookie Value[ ] =$details; setcookie(history Details, json_encode($cookie Value), ......); Don't 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!