Well that may be, but I think you are saving the wrong file. The code I posted should not produce any notice errors. My 2cents, you are saving the wrong file.
Here is the code I tested on my server, with no notice errors etc.
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
if (!isset($_POST['submit']) || ($_POST['val1'] == "") || ($_POST['val2'] == "") || ($_POST['calc'] == "")) {
header("Location: calculate_form.php");
exit;
}
if ($_POST['calc'] == "add") {
$result = $_POST['val1'] + $_POST['val2'];
$what = " plus ";
} else if ($_POST['calc'] == "subtract") {
$result = $_POST['val1'] - $_POST['val2'];
$what = " minus ";
} else if ($_POST['calc'] == "multiply") {
$result = $_POST['val1'] * $_POST['val2'];
$what = " times ";
} else if ($_POST['calc'] == "divide") {
$result = $_POST['val1'] / $_POST['val2'];
$what = " divided by ";
}
echo 'My calculations returned: ' . $_POST['val1'] . $what . $_POST['val2'] . " = " . $result;
?>
Which returned:
My calculations returned: 2 plus 3 = 5
It seems as you were typing this, I edited my previous post... I did end up getting it working with your previous post. Thanks alot! It did work
For the most part, I see what was wrong, and it's weird the publisher hadn't mentioned it. But to say the least - the book has been the best one yet (no throwing in stuff and not telling me about it!). Considering how much I've learned here compared to a whole bunch of other places, I decided I will finish this book.
Helping me fix that code taught me a few things, and props to you for taking time to help me out here. You rock!