Discussion – Lesson 5 - Associative arrays in PHP and submitting forms
BackComments
3 messages from 3 displayed.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
Comments
This is not the code from our zip archive. You're mixing PHP and HTML code. Download the zip archive and look into the files, it'll help you to understand your mistakes.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Calculator</title>
</head>
<body>
<p>Welcome to the calculator, please enter 2 numbers and you will get their sum.</p>
<form method="POST" action="sum.php">
<input name="number1" type="text" /><br />
<input name="number2" type="text" /><br />
<input type="submit" value="Compute" />
</form>
</body>
</html>
<?php
$sum = $_POST['number1'] + $_POST['number2'];
echo("Sum Value: $sum");
?>
3 messages from 3 displayed.