Jump to content

PetitSuisse

New Members
  • Posts

    1
  • Joined

  • Last visited

PetitSuisse's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have the same book, and after spending ages trying to see if I made a type, google brought me here and ended my frustrations. The amazon reviews for this book are awful, but we're using it in class, and although there are many errors the structure of the book is pretty good, and just like you, I ended up learning something because of the errors. My solution ended up working like this: <?php if ( ($_POST['val1']=="") || ($_POST['val2']=="") || ($_POST['calc']=="") ) { header("Location:calcform.php"); exit; } if ($_POST['calc'] == "add") { $result = $_POST['val1'] + $_POST['val2']; } else if ($_POST['calc'] == "subtract") { $result = $_POST['val1'] - $_POST['val2']; } else if ($_POST['calc'] == "multiply") { $result = $_POST['val1'] * $_POST['val2']; } else if ($_POST['calc'] == "divide") { $result = $_POST['val1'] / $_POST['val2']; } ?> <!DOCTYPE html> <head> <title>Calculation Result</title> </head> <body> <p>The result of the calculation is <?php echo "$result"; ?>!</p> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.