Hi. I have recently moved my website to another host, but they dont do Classic ASP (yes I know it's old, so am I ) so I am having to re-write the thing in HTML and PHP. Maybe someone can help me with a small but infuriating problem which I have spent two days trying to figure out. Here it is:
I have two variables, $A and $B each of which contains a randomly generated number. These numbers are displayed in a Form on the screen. Then I have a text Input tag where the user can add together the two numbers then type in the answer. The code then needs to compare the sum of the two numbers with the user answer and behave according to whether the answer is correct or not. The problem is I dont seems to be able get the user answer from the text input. When I submit the Form (method Post) the input just seems to disappear into the ether and I cant find it.
Here's the input
<input type="text" id="answer" name="user_answer" title="type your answer here" value=""/>
and here's the routine which I expected to store the user input in the variable $answer
if (empty($_POST["user_answer"])) {
$answerErr = "* Answer req'd";
} else {
$answer = test_input($_POST["user_answer"]);
}
}
Any help would be greatly appreciated
EDIT: I'm new here and when I was completing the registration form I noticed that it contains a Verification section which is exactly what I'm trying to do!
I have two variables, $A and $B each of which contains a randomly generated number. These numbers are displayed in a Form on the screen. Then I have a text Input tag where the user can add together the two numbers then type in the answer. The code then needs to compare the sum of the two numbers with the user answer and behave according to whether the answer is correct or not. The problem is I dont seems to be able get the user answer from the text input. When I submit the Form (method Post) the input just seems to disappear into the ether and I cant find it.
Here's the input
<input type="text" id="answer" name="user_answer" title="type your answer here" value=""/>
and here's the routine which I expected to store the user input in the variable $answer
if (empty($_POST["user_answer"])) {
$answerErr = "* Answer req'd";
} else {
$answer = test_input($_POST["user_answer"]);
}
}
Any help would be greatly appreciated
EDIT: I'm new here and when I was completing the registration form I noticed that it contains a Verification section which is exactly what I'm trying to do!