Hello,
I have the following code and I'm trying to get the first two array returns to print out the numbers to the page.
example: 3+5=
the problem I'm having is that it's printing out literally, that is, it's outputting:
Array ['number1'] + Array ['number2'] =8
when I use the radio button in the form option for addtion.
I can't seem to get the values out of the first two array values - well, here is the code:
<?php
error_reporting (E_ERROR | E_WARNING |E_PARSE);
if ( $_GET ['op'] == "add" ) { echo " $_GET ['number1'] + $_GET ['number2'] ="; echo $_GET ['number1'] + $_GET ['number2'];}
if ( $_GET ['op'] == "sub" ) { echo " $_GET ['number1'] - $_GET ['number2'] "; echo $_GET ['number1'] - $_GET ['number2'];}
if ( $_GET ['op'] == "mul" ) { echo " $_GET ['number1'] * $_GET ['number2'] "; echo $_GET ['number1'] * $_GET ['number2'];}
if ( $_GET ['op'] == "div" ) { echo " $_GET ['number1'] / $_GET ['number2'] "; echo $_GET ['number1'] / $_GET ['number2'];}
?>
And here is the HTML code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="get" action="basicAction.php">
Enter Number <input type="text" name="number1"><br>
Enter Number <input type="text" name="number2"><br><br>
<b>Choose the operation</b><br><br>
<input type="radio" name="op" value="add" checked>
Addition<br> <input type="radio" name="op" value="sub">
Subtraction<br> <input type="radio" name="op" value="mul">
Multiplication<br> <input type="radio" name="op" value="div">
Division<br> <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>