Hello,
I have two tables.
Table 1 contains 10 questions with options for answer like: ID Question OPTION1 OPTION2 OPTION3 OPTION4.
The second table contains : ID USERNAME QUESTION1-------QUESTION10 ANSWER!--------ANSWER10
Now what i want is that when user logins, he should be presented with those 10questions from TAble 1.
With those questions he should be presented with options. When he answer those, that should be inserted into table 2 Table 2 already has ID and USERNAME filled.
Till now, i have succeeded in displaying the data to the user page in below code. Here the question is represented through Placeholder. But i dont know how to take user input from this and how to insert it into database.
<?php
$sql = "SELECT * FROM mymake ";
$query = mysqli_query($db_conx,$sql);
$numrows = mysqli_num_rows($query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
form > select { width:280px;}
</style>
</head>
<body>
<form method="post" action="hello.php">
<?php
if ($numrows > 0){
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
?>
<input type="text" name="q[]" placeholder="<?php echo $row["question"];?>" size="82" disabled >
<select name="response[]" required="required">
<option value=""></option>
<option value="<?php echo $row["option1"]; ?>"><?php echo $row["option1"]; ?></option>
<option value="<?php echo $row["option2"]; ?>"><?php echo $row["option2"]; ?></option>
<option value="<?php echo $row["option3"]; ?>"><?php echo $row["option3"]; ?></option>
</select>
<br>
<?php
}
}
?>
<br /><input type="submit" value="Ready to Go" name="submit" />
<input type="reset" value="Reset" name="reset" />
</form>
</body>
</html>