Forum Moderators: coopster
As I said in my previous post I'm very new to PHP, so please bare with my newbie question and thanx for any and all help.
Well, I'm just testing the waters right now and I'm trying to make a simple html page that will ask for two numbers and after the data is submited calculate the result and print it. Everything works, but there are two annoying notices that I can't get rid of. Here it is in detail, it's really simple:
The HTML Form file:
------------------------------------------
<html>
<head>
<title>Simple adding</title>
</head>
<body>
<form method="post" action="add.php">
<input name="number1" type="text" size="10">
<input name="number2" type="text" size="10">
<input type="submit" value="Add Numbers">
</form>
</body>
</html>
----------------------------------------
The php file with the calculation script:
----------------------------------------
<?
$result = $_POST[number1] + $_POST[number2];
?>
<html>
<head>
<title></title>
</head>
<body>
<p> The Result is <? echo "$result";?>
</body>
</html>
--------------------------------
Upon execution of the above I AM getting the right output but in addition I get this:
Notice: Use of undefined constant number1 - assumed 'number1' in .....wherever and
Notice: Use of undefined constant number2 - assumed 'number2' in ..... wherever
Why am I getting this, even though my result is being displayed properly (e.g. if i input 5 and 5 i'll get 10)
Thanks!
Astinov