What's wrong w my php code? Just trying to make a very simple form here...*_*?

somebody

New member
hi, I am new to php. trying to make a simple form 1 + 1 = [answerhere] ? but I just cann't get the php code to work. : ( , help plz.

The site is here, look at the center where it says 1 + 1
http://www.testmyskills.net16.net/sites/page2.html


<form action="math1.php" method="post">
What is 1 + 1 ?<input type="text" name="answer1" />
<br />
<br />
<input type="submit" /><input type="reset" />
</form>


The math1.php code is here:
<html>
<body>
<?php
$a=answer1
if ($a=="2") ;
echo "That is right!";
else
echo "That is WRONG !" ;



?>
</body>
</html>

If it take too much words to explain, would you plz just give me the code? I will look it through very carefully. MANY MANY THANKS : )

(Also, even if I got everything right. I found out that the php response will be return in a new window. I try to put a php form into a table cell, but it didn't work. It will refresh the page. Is there anyway I could get the answer/response from php without refreshing the webpage? many many thanks)
 
Back
Top