01292003 1540 CST

When I run this script I get the html at the end but no $result. If the
result is run on the same page as the output, there shouldnt be anything
variable wise stopping this from running, right?

Wade

<?php
    if (($_POST["val1"] == " ") || ($_POST["val2"] == " ") ||
($_POST["calc"] == " "))
    {
        header("Location: http://localhost/Learning PHP/PHP Fast &
Easy/Ch_6/calculate_form.html");
        exit;
    }

    if ($_POST["calc"] == "add")
    {
        $result = $val1 + $val2;
    }

        else if ($_POST["calc"] == "subtract")
        {
             $result = $val1 - $val2;
        }

        else if ($_POST["calc"] == "multiply")
        {
             $result = $val1 *  $val2;
        }

        else if ($_POST["calc"] == "divide")
        {
            $result = $val1 / $val2;
        }

?>

<html>
<head>
<title>Calculation Result</title>
<head>

<body>
    <p>The result of the calculation is: <?php "$result"; ?></p>
</body>
</html>


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to