SHARE
TWEET

Untitled

a guest Mar 7th, 2012 256 Never
  1. <form name="input" action="Paycheck.php" method="get">
  2. Insert wage: <input type="text" name="wage" />
  3. Insert hours worked: <input type="text" name="hours" />
  4. <input type="submit" value="Calculate Salary" />
  5. </form>
  6.  
  7. <?php
  8. $hours = $_GET['hours'];
  9. $wage = $_GET['wage'];
  10. $salary = 0;
  11.  
  12. if(hours > 40)
  13. {
  14. $salary = 40 * $wage + ($hours - 40) * $wage * 1.5;
  15. }
  16. else
  17. {
  18. $salary = $hours * $wage;
  19. }
  20.  
  21. echo $salary;
  22. }
RAW Paste Data
Top