skeptical
April 13th, 2002, 21:51
<html>
<body>
<?
$Q[0] = "Your name is:";
$real[0] = "bob";
$Q[1] = "Your age is:";
$real[1] = "200";
if(!isset($yourans[0]))
{
print("<form method=post action=$PHP_SELF>");
for($i = 0; $i < 2; $i++)
{
print($Q[$i]);
print("<input type=text name=\"$yourans[$i]\" value=\"$yourans[$i]\"> <br>");
}
print("<input type=submit value='Submit'></form>");
}
else
{
for($i = 0; $i < 2; $i++)
{
print($Q[$i]);
print("<br>Your answer:<br> ");
print($yourans[$i]);
if($yourans[$i] == $real[$i]) print("<br>Correct!");
else print("<br>Wrong!");
}
}
?>
The above is a simple php inputting thingy I'm making. I want a user to type in their and age. Then when they click submit, it will output whether they are Correct or Wrong. However, when I tried this, it doesnt come out right.
example input:
name: bob
age: 90
Your name is:
Wrong!
Your age is: 9
0
Wrong!
???? any help???
<body>
<?
$Q[0] = "Your name is:";
$real[0] = "bob";
$Q[1] = "Your age is:";
$real[1] = "200";
if(!isset($yourans[0]))
{
print("<form method=post action=$PHP_SELF>");
for($i = 0; $i < 2; $i++)
{
print($Q[$i]);
print("<input type=text name=\"$yourans[$i]\" value=\"$yourans[$i]\"> <br>");
}
print("<input type=submit value='Submit'></form>");
}
else
{
for($i = 0; $i < 2; $i++)
{
print($Q[$i]);
print("<br>Your answer:<br> ");
print($yourans[$i]);
if($yourans[$i] == $real[$i]) print("<br>Correct!");
else print("<br>Wrong!");
}
}
?>
The above is a simple php inputting thingy I'm making. I want a user to type in their and age. Then when they click submit, it will output whether they are Correct or Wrong. However, when I tried this, it doesnt come out right.
example input:
name: bob
age: 90
Your name is:
Wrong!
Your age is: 9
0
Wrong!
???? any help???