Hello I'm new in this forum but i hope you understand what I trying to do.
The code don't work and I get an notice too.
Notice: Undefined index: answer in C:\wamp\www\ss\new.php on line 4
I think you understand what i want but i will explain if you don't.
If they write 4 in the textfield the echo will say Right the answer is 4. But if they write anything else
it will say wrong try again!
Now i wonder what have i do wrong?
<?php $theanswer = 4; $answer = $_POST['answer']; if(isset($_POST['button'])){ if ($theanswer = $answer){ echo "Right the answer is 4<br>"; } else { echo "Wrong try again!"; } } ?> 2 + 2 is? <form method="post" action="new.php"> <input type="text" name="answer"> <input type="submit" name="button"> </form>
The code don't work and I get an notice too.
Notice: Undefined index: answer in C:\wamp\www\ss\new.php on line 4
I think you understand what i want but i will explain if you don't.
If they write 4 in the textfield the echo will say Right the answer is 4. But if they write anything else
it will say wrong try again!
Now i wonder what have i do wrong?