Hi
I'm been trying to enter numbers into the <input> so I can calculate Add - Subtract - Divide - Multiply.
This is the equations:
<?php
$number = 20;
$number += 10;
print "\$number += 10;<br /> The answer is <b>$number</b>. <br /><br />";
$number -= 12;
print "\$number -= 12;<br /> The answer is <b>$number</b>. <br /><br />";
$number *= 14;
print "\$number *= 14;<br /> The answer is <b>$number</b>. <br /><br />";
$number%= 16;
print "\$number %= 16;<br /> The answer is <b>$number</b>. <br /><br />";
?>
This is my form:
<html>
<body>
<form action="number.php" method="get">
Enter number: <input type="text" name="number" /><br /><br />
Enter number to Add: <input type="text" name="add" /><br /><br />
Enter number to Subtract: <input type="text" name="subtract" /><br /><br />
Enter number to multiply: <input type="text" name="multiply" /><br /><br />
Enter number to divide: <input type="text" name="divide" /><br /><br />
<input type="submit" value="Submit">
</form>
</body>
</html>
This is my number.php
$number = ' ';
$number += ' ';
$number -= ' ';
$number *= ' ';
$number %= ' ';
$number = isset($_GET['number']) ? (float)$_GET['number'] : 0;
This is what I got so far. I'm having problems calculating 4 different operator at once.
Any Suggestions and explanation will help. I appreciate it. Thanks!