| | |
errors and errors
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2007
Posts: 8
Reputation:
Solved Threads: 0
i made a form with 2 input buttons(for taking number inputs) and 4 radio buttons(add sub mul and divide) and one submit button(calculate) to make a simple calculator and wrote a php script which takes input values and and according to the button selected do the operation but when i run this in browser and give values , select the required button it gives a list of errors about unused radio buttons (like if i select sub then at all the rest add mul and divide buttons it gives error) and in the last line shows correct answer, wha's this?
here is the code ofr script
------------------------------------------------------------------
this one for form
-----------------------------------------------------
and this one the error list
Notice: Use of undefined constant vall - assumed 'vall' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant val2 - assumed 'val2' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant calc - assumed 'calc' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant calc - assumed 'calc' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 6
Notice: Use of undefined constant vall - assumed 'vall' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 7
Notice: Use of undefined constant val2 - assumed 'val2' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 7
The result of the calculation is: 3
---------------------------------------------------------------
if any one could help me
i dont want this error list before the answer
here is the code ofr script
php Syntax (Toggle Plain Text)
<?php if (($_POST[vall] == "") || ($_POST[val2] == "") || ($_POST[calc] =="")) { header("Location: http://127.0.0.1/calculate_form.html"); exit; } if ($_POST[calc] == "add") { $result = $_POST[vall] + $_POST[val2]; } else if ($_POST[calc] == "subtract") { $result = $_POST[vall] - $_POST[val2]; } else if ($_POST[calc] == "multiply") { $result = $_POST[vall] * $_POST[val2]; } else if ($_POST[calc] == "divide") { $result = $_POST[vall] / $_POST[val2]; } ?> <HTML> <HEAD> <TITLE>Calculation Result</TITLE> </HEAD> <BODY> <P>The result of the calculation is: <? echo "$result"; ?></P> </BODY> </HTML>
this one for form
html Syntax (Toggle Plain Text)
<HTML> <HEAD> <TITLE>Calculation Form</TITLE> </HEAD> <BODY> <FORM METHOD="POST" ACTION="calculate.php"> <P>Value 1: <INPUT TYPE="text" NAME="vall" SIZE=10></P> <P>Value 2: <INPUT TYPE="text" NAME="val2" SIZE=10></P> <P>Calculation:<br> <INPUT TYPE="radio" NAME="calc" VALUE="add"> add<br> <INPUT TYPE="radio" NAME="calc" VALUE="subtract"> subtract<br> <INPUT TYPE="radio" NAME="calc" VALUE="multiply"> multiply<br> <INPUT TYPE="radio" NAME="calc" VALUE="divide"> divide</P> <P><INPUT TYPE="submit" NAME="submit" VALUE="Calculate"></P> </FORM> </BODY> </HTML>
and this one the error list
Notice: Use of undefined constant vall - assumed 'vall' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant val2 - assumed 'val2' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant calc - assumed 'calc' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 2
Notice: Use of undefined constant calc - assumed 'calc' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 6
Notice: Use of undefined constant vall - assumed 'vall' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 7
Notice: Use of undefined constant val2 - assumed 'val2' in d:\backup data\data a\a\miscallaneous data\ebooks\web languages\myphp\test\calculate.php on line 7
The result of the calculation is: 3
---------------------------------------------------------------
if any one could help me
i dont want this error list before the answer Last edited by peter_budo; Apr 5th, 2008 at 1:33 pm. Reason: Keep It Organized - please use [code] tags
![]() |
Similar Threads
- C Program help - Conway's Life - Stumped by some errors. (C)
- Binary Recursion Function Errors - Help!! (C++)
- Am Getting System Errors When running my VB.NET project (VB.NET)
- Errors help (C++)
- compilation errors (C++)
- STOP Errors Before AND After Upgrade (Windows NT / 2000 / XP)
- Errors with membering functions in a class (C++)
- Wt? "compiling and linking errors" (C++)
Other Threads in the PHP Forum
- Previous Thread: Send variable from javascript to php?
- Next Thread: PHP4 regular expressions?
Views: 639 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






