Quote:
Originally Posted by cinq
Maybe you can try this
Code:
<html>
<head>
<title>The PHP Calculator :+)</title>
</head>
<body bgcolor="#FFFFFF">
<strong>The PHP Calculator</strong>
<form action="Form_Handeling.php" method="post">
First Number:
<input type="text" name="number_one" maxlength="3">
<br />
Second Number:
<input type="text" name="number_two" maxlength="3">
<br />
Operator:
<select name="action">
<option value="+">Add those mofos!</option>
<option value="-">Subtract those mofos!</option>
<option value="/">Divide those mofos!</option>
<option value="*">Multiply those mofos!</option>
</selct>
<input type="submit" value="Calculate!">
</body>
</html>
PHP Code:
<html>
<head>
<title>The result is....</title>
</head>
<body>
<?php
$number1 = $_POST['number_one'];
$number2 = $_POST['number_two'];
$action = $_POST['action'];
if($action == "+"){ $sum = $number1 + $number2 ;}
if($action == "-"){ $sum = $number1 - $number2 ;}
if($action == "/"){ $sum = $number1 / $number2 ;}
if($action == "*"){ $sum = $number1 * $number2 ;}
echo $sum;
?>
</body>
</html>
|
Gives a blank page when submitting...