Final Question 19 pg 2 - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Final Question 19 pg 2.php

  1. <?php
  2. session_start();   //second page?
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6. <body>
  7.  
  8. <?php
  9. $tax = .12;
  10. $medicare = .062;
  11. $yearly_pay = 0;
  12. $total = 0;
  13.  
  14. $_SESSION["name"] = $name;
  15. $_SESSION["rate_of_pay"] = $rate_of_pay;
  16. $_SESSION["hours_worked"] = $hours_worked;
  17. $_SESSION["relatons"] = $relatons;
  18.  
  19. echo $name;
  20. echo $rate_of_pay;
  21. echo $hours_worked;
  22.  
  23. $yearly_pay = $rate_of_pay * $hours_worked;
  24. $total = $yearly_pay * ($medicare + $tax);
  25.  
  26. echo "Your total with deductions is $total";
  27.  
  28. ?>
  29.  
  30. </body>
  31. </html>
  32.  
File Description
  • Final Question 19 pg 2
  • PHP Code
  • 14 Apr-2021
  • 493 Bytes
You can Share it: