php script to echo html form
this is my code
<form action = "calculateResult.php" method = "post">
<?php
$con=mysqli_connect("localhost","root","","online_ exam");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM question");
//$AnsResult = mysqli_query($con,"SELECT * FROM answers");
$i = 1;
while($row = mysqli_fetch_array($result))
{
$i = $i + 1;
$question = $row['Quest'];
print("$question");
echo '<br/>';
$Q1 = $row['answer1'];
$Q2 = $row['answer2'];
$Q3 = $row['answer3'];
$Q4 = $row['answer4'];
echo '<input type = "checkbox" value = "hi" name = "answers"/>'.$Q1;
echo '<br/>';
echo '<input type = "checkbox">'.$Q2;
echo '<br/>';
echo '<input type = "checkbox">'.$Q3;
echo '<br/>';
echo '<input type = "checkbox">'.$Q4;
echo '<br/>';
}
mysqli_close($con);
?>
<input type = "submit" value = "SUBMIT"/>
</form>
this statement print("$question"); is suppose to execute before this other statements but the echo '<input type = "checkbox" value = "hi" name = "answers"/>'.$Q1; execute before the print("$question"); statement that is what i mean
echo '<input type = "checkbox" value = "hi" name = "answers"/>'.$Q1;
echo '<br/>';
echo '<input type = "checkbox">'.$Q2;
echo '<br/>';
echo '<input type = "checkbox">'.$Q3;
echo '<br/>';
echo '<input type = "checkbox">'.$Q4;
echo '<br/>';
-
Andrew H -
Thanks - 1 reply
Signature"You shouldn't come here and set yourself up as the resident wizard of oz." {{ DiscussionBoard.errors[8657590].message }}-
lloydblinks -
Thanks
{{ DiscussionBoard.errors[8658833].message }} -
-
-
Andrew H -
Thanks
Signature"You shouldn't come here and set yourself up as the resident wizard of oz." {{ DiscussionBoard.errors[8659821].message }} -
-
KirkMcD -
Thanks
{{ DiscussionBoard.errors[8661420].message }} -
-
David Beroff -
Thanks
SignaturePut MY voice on YOUR video: AwesomeAmericanAudio.com{{ DiscussionBoard.errors[8662356].message }} -
-
drem -
Thanks
SignaturePremium Content by Real English Writers That Will Have Your Visitors Coming Back for More{{ DiscussionBoard.errors[8663118].message }} -
-
Lanii -
Thanks
SignatureFastest Proxy Software! Get SOCKS 4/5 and Elite Proxies 100% Autopilot!{{ DiscussionBoard.errors[8663912].message }} -