Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.html
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Week 3</title>
- </head>
- <body>
- <!--form 1-->
- <form name="myform" id="myform" action="welcome.php" method="post">
- First Name: <input type="text" name="fname" id="fname">
- Last Name: <input type="text" name="lname" id="lname">
- Age: <input type="text" name="age" id="age">
- Email: <input type="text" name="email" id="email">
- <input type="submit" name="submit" value=Submit>
- </form>
- <br><br>
- <!--form 2-->
- <form name="form2" id="form2" action="results.php" method="get">
- Name: <input type="text" name="name" id="name" /> <br /><br />
- Gross Salary:
- <input type="number" name="gross" id="gross" /> <br /><br />
- Other Deductibles (NIS, CNG conversion, Annuity):
- <input type="number" name="deduct" id="deduct" />
- <br /><br />
- <input type="submit" name="calculate" value="calculate" />
- </form>
- </body>
- </html>
- welcome.php
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Welcome</title>
- </head>
- <body>
- <?php
- $name = $_POST["fname"]. ' ' .$_POST["lname"];
- $age = $_POST["age"];
- $email = $_POST["email"];
- echo "Welcome, $name. You are $age Years old. Your email is $email.";
- ?>
- </body>
- </html>
- results.php
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Results</title>
- </head>
- <body>
- <?php
- $reg_deductible = 84000;
- $gross = $_GET["gross"];
- $other_deduct = $_GET["deduct"];
- $taxable = $gross - ($reg_deductible + $other_deduct);
- $taxes = $taxable * 0.25;
- $net = $gross - $taxes;
- echo "<h3>Your taxes details are:</h3><br/> Gross Income: $gross
- <br/> Taxable Income = $taxable <br/> <strong>Taxes Due: $taxes
- </strong><br/> <br/> Thank you for using our tax calculator application
- :)";
- ?>
- <!--
- <?php
- // initialize output variable
- $output = "<p></p>";
- if (isset($_GET["calc"])) {
- $reg_deductible = 84000;
- $gross = $_GET["gross"];
- $other_deduct = $_GET["deduct"];
- $taxable = $gross - ($reg_deductible + $other_deduct);
- $taxes = $taxable * 0.25;
- $net = $gross - $taxes;
- $output = "<h3 style='color: blue;'>Hello $_GET[name], your tax details are:</h3><p> Gross Income: $gross
- <br/> Taxable Income = $taxable <br/> <span class='emphasize'>Taxes Due: $taxes
- </span><br/> <br/> Thank you for using our tax calculator application
- :)</p>";
- }
- ?>
- -->
- </body>
- </html>
- index2.php
- <?php
- $output = "";
- if (isset($_GET["calculate"])) {
- $reg_deductible = 84000;
- $gross = $_GET["gross"];
- $other_deduct = $_GET["deduct"];
- $taxable = $gross - ($reg_deductible + $other_deduct);
- $taxes = $taxable * 0.25;
- $net = $gross - $taxes;
- $output = "<h3 style='color: blue;'>Hello $_GET[name], your tax details are:</h3><p> Gross Income: $gross
- <br/> Taxable Income = $taxable <br/> <span class='emphasize'>Taxes Due: $taxes
- </span><br/> <br/> Thank you for using our tax calculator application
- :)</p>";
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>All-in-one</title>
- </head>
- <body>
- <form name="form2" id="form2" action="index2.php" method="get">
- Name: <input type="text" name="name" id="name" /> <br /><br />
- Gross Salary:
- <input type="number" name="gross" id="gross" /> <br /><br />
- Other Deductibles (NIS, CNG conversion, Annuity):
- <input type="number" name="deduct" id="deduct" />
- <br /><br />
- <input type="submit" name="calculate" value="calculate" />
- </form>
- <?php
- echo $output;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement