Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- form.html
- <html>
- <head>
- <title>A form</title>
- </head>
- <body>
- <form method = "get" action = "test.php">
- WP: <input type = "text" name = "wp" />
- CN: <input type = "text" name = "cn" />
- COA: <input type = "text" name = "coa" />
- <input type = "submit" value ="Find average"/>
- </form>
- </body>
- </html>
- test.php
- <html>
- <body>
- <?php
- function calcAvg($wp, $cn, $coa){
- return ($wp+$cn+$coa)/3;
- }
- $wp = $_GET["wp"];
- $cn = $_GET["cn"];
- $coa = $_GET["coa"];
- $average = calcAvg($wp, $cn, $coa);
- echo "The average is ". $average;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement