Advertisement
thotfrnk

week3.php & html

Oct 14th, 2023 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.96 KB | None | 0 0
  1. index.html
  2. <!DOCTYPE html>
  3.  
  4. <html lang="en">
  5. <head>
  6.   <meta charset="UTF-8">
  7.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.   <title>Week 3</title>
  9. </head>
  10. <body>
  11.   <!--form 1-->
  12.   <form name="myform" id="myform" action="welcome.php" method="post">
  13.     First Name: <input type="text" name="fname" id="fname">
  14.     Last Name: <input type="text" name="lname" id="lname">
  15.     Age: <input type="text" name="age" id="age">
  16.     Email: <input type="text" name="email" id="email">
  17.     <input type="submit" name="submit" value=Submit>
  18.     </form>
  19.  
  20.     <br><br>
  21.  
  22.     <!--form 2-->
  23.     <form name="form2" id="form2" action="results.php" method="get">
  24.       Name: <input type="text" name="name" id="name" /> <br /><br />
  25.       Gross Salary:
  26.       <input type="number" name="gross" id="gross" /> <br /><br />
  27.       Other Deductibles (NIS, CNG conversion, Annuity):
  28.       <input type="number" name="deduct" id="deduct" />
  29.       <br /><br />
  30.       <input type="submit" name="calculate" value="calculate" />
  31.       </form>
  32. </body>
  33. </html>
  34.  
  35. welcome.php
  36. <!DOCTYPE html>
  37.  
  38. <html lang="en">
  39. <head>
  40.   <meta charset="UTF-8">
  41.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  42.   <title>Welcome</title>
  43. </head>
  44. <body>
  45.   <?php
  46.   $name = $_POST["fname"]. ' ' .$_POST["lname"];
  47.   $age = $_POST["age"];
  48.   $email = $_POST["email"];
  49.  
  50.   echo "Welcome,  $name.  You are   $age  Years old. Your email is  $email.";
  51.   ?>
  52. </body>
  53. </html>
  54.  
  55. results.php
  56. <!DOCTYPE html>
  57. <html lang="en">
  58. <head>
  59.   <meta charset="UTF-8">
  60.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  61.   <title>Results</title>
  62. </head>
  63. <body>
  64.   <?php
  65.   $reg_deductible = 84000;
  66.   $gross = $_GET["gross"];
  67.   $other_deduct = $_GET["deduct"];
  68.   $taxable = $gross - ($reg_deductible + $other_deduct);
  69.   $taxes = $taxable * 0.25;
  70.   $net = $gross - $taxes;
  71.   echo "<h3>Your taxes details are:</h3><br/> Gross Income: $gross
  72.  <br/> Taxable Income = $taxable <br/> <strong>Taxes Due: $taxes
  73.  </strong><br/> <br/> Thank you for using our tax calculator application
  74.  :)";
  75.   ?>
  76.   <!--
  77.   <?php
  78.  
  79. // initialize output variable
  80. $output = "<p></p>";
  81.  
  82. if (isset($_GET["calc"])) {
  83.  
  84.  
  85.     $reg_deductible = 84000;
  86.     $gross = $_GET["gross"];
  87.     $other_deduct = $_GET["deduct"];
  88.     $taxable = $gross - ($reg_deductible + $other_deduct);
  89.     $taxes = $taxable * 0.25;
  90.     $net = $gross - $taxes;
  91.     $output = "<h3 style='color: blue;'>Hello $_GET[name], your tax details are:</h3><p> Gross Income: $gross
  92.        <br/> Taxable Income = $taxable <br/> <span class='emphasize'>Taxes Due: $taxes
  93.        </span><br/> <br/> Thank you for using our tax calculator application
  94.        :)</p>";
  95.  
  96. }
  97. ?>
  98.   -->
  99. </body>
  100. </html>
  101.  
  102. index2.php
  103. <?php
  104. $output = "";
  105. if (isset($_GET["calculate"])) {
  106.  
  107.   $reg_deductible = 84000;
  108.   $gross = $_GET["gross"];
  109.   $other_deduct = $_GET["deduct"];
  110.   $taxable = $gross - ($reg_deductible + $other_deduct);
  111.   $taxes = $taxable * 0.25;
  112.   $net = $gross - $taxes;
  113.   $output = "<h3 style='color: blue;'>Hello $_GET[name], your tax details are:</h3><p> Gross Income: $gross
  114.  <br/> Taxable Income = $taxable <br/> <span class='emphasize'>Taxes Due: $taxes
  115.  </span><br/> <br/> Thank you for using our tax calculator application
  116.  :)</p>";
  117. }
  118. ?>
  119.  
  120.  
  121. <!DOCTYPE html>
  122. <html lang="en">
  123. <head>
  124.   <meta charset="UTF-8">
  125.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  126.   <title>All-in-one</title>
  127. </head>
  128. <body>
  129. <form name="form2" id="form2" action="index2.php" method="get">
  130.       Name: <input type="text" name="name" id="name" /> <br /><br />
  131.       Gross Salary:
  132.       <input type="number" name="gross" id="gross" /> <br /><br />
  133.       Other Deductibles (NIS, CNG conversion, Annuity):
  134.       <input type="number" name="deduct" id="deduct" />
  135.       <br /><br />
  136.       <input type="submit" name="calculate" value="calculate" />
  137.       </form>
  138.  
  139.       <?php
  140.       echo $output;
  141.       ?>
  142. </body>
  143. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement