Need help
Posted: Thu Dec 24, 2009 8:54 am
As i am new in php field, i write a code but giving errors..
i create calculate.html and write this..
i create calculate.html and write this..
and then create "calculate.php" and there i write this<form method="post" action="calculate.php">
<input type="text" name="val1" size="15" /> <br></br>
<input type="text" name="val2" size="15" /><br></br>
ADD <input type ="radio" name="calc" value ="add" /><br>
Sub <input type="radio" name ="calc" value ="sub" /><br>
Multiply <input type="radio" name="calc" value="multiply" /><br>
Divide <input type="radio" name="calc" value="divide" /><br><br>
<input type="submit" name="submit" value="Calculate" />
but it is not showing when i add 2 variables.please help me<?php
if ($_post[calc] == "add")
{
$result = $_POST[val1] + $_POST[val2];
}
echo $result;
?>