I've got this code in the survey.php page. Included in this page is the database connection--that's not the problem. The previous page that enters the username and password is just standard HTML. Please look at this code and let me know what it should be to update the form fields--I'm going to have all the passwords and usernames already entered. PLEASE HELP!!! 😃
<?
include("conn.php")
?>
<html>
<head>
<title>Liberty Survey</title>
</head>
<body>
<?
if(mysql_query("SELECT FROM survey WHERE username='$username' AND password='$password' AND taken='1')){
print("Sorry, you have already taken this survey");
}
elseif(mysql_query("SELECT FROM survey WHERE username = '$username' AND password = '$password'")){
$result = mysql_query($sql);
$num = mysql_numrows($result);
if ($num = "0") {
print("<h1>You are not authorized to take this survey</h1>")
}
}
else{
?>
<form action="survey.php" method="POST">
<p><b>Question 1: <input type="text" maxlength="3" name="one">
<br>Question 2: <input type="text" name="two">
<br><input type="Submit" name="onto2">
<?
}
if(isset($onto2)):
$sql = "UPDATE survey SET one='$one', two='$two' WHERE username='$username', password='$password'";
mysql_query($sql);
echo 'Database query successful';
print("<h2>Thank you for taking this survey</h2>");
else:
endif;
?>
</body>
</html>