| | |
How to prepare Quiz
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 20
Reputation:
Solved Threads: 0
Hi,
I have created a database, a table and stored 3 questions in the table. I need to show the questions one by one to users. when first question is visible then while loop should wait until user click on submit button.
My Code is::
nclude("dbconnect.php");
$result=mysql_query("select * from English") or
die (mysql_error());
while ($row = mysql_fetch_array($result))
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>English Quiz</title>
<meta name="GENERATOR" content="Created by Narayankumar">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="bv_Text1" style="position:absolute;left:0px;top:0px;width:196px;height:32px;z-index:0" align="left">
<font style="font-size:27px" color="#000000" face="Arial"><b>Engilsh Quiz:</b></font></div>
<div id="bv_Text2" style="position:absolute;left:0px;top:52px;width:500px;height:16px;z-index:1" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['QN']; echo ". "; echo $row['Q']; ?></font></div>
<form action="evalution.php" method='POST'>
<input type="radio" id="RadioButton1"" name="Q" value="A" style="position:absolute;left:0px;top:78px;z-index:2">
<input type="radio" id="RadioButton2"" name="Q" value="B" style="position:absolute;left:0px;top:110px;z-index:3">
<input type="radio" id="RadioButton3"" name="Q" value="C" style="position:absolute;left:0px;top:142px;z-index:4">
<input type="radio" id="RadioButton4"" name="Q" value="D" style="position:absolute;left:0px;top:175px;z-index:5">
<input type="submit" name="submit" value="Submit" style="position:absolute;left:39px;top:216px;width:75px;height:24px;z-index:10">
</form>
<div id="bv_Text3" style="position:absolute;left:33px;top:78px;width:201px;height:16px;z-index:6" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['A']; ?></font></div>
<div id="bv_Text4" style="position:absolute;left:33px;top:110px;width:201px;height:16px;z-index:7" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['B']; ?></font></div>
<div id="bv_Text5" style="position:absolute;left:33px;top:142px;width:201px;height:16px;z-index:8" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['C']; ?></font></div>
<div id="bv_Text6" style="position:absolute;left:33px;top:176px;width:201px;height:16px;z-index:9" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['D']; ?></font></div>
</body>
</html>
<?
sleep(10);
}
?>
Please help me what i need to change?
I have created a database, a table and stored 3 questions in the table. I need to show the questions one by one to users. when first question is visible then while loop should wait until user click on submit button.
My Code is::
nclude("dbconnect.php");
$result=mysql_query("select * from English") or
die (mysql_error());
while ($row = mysql_fetch_array($result))
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>English Quiz</title>
<meta name="GENERATOR" content="Created by Narayankumar">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="bv_Text1" style="position:absolute;left:0px;top:0px;width:196px;height:32px;z-index:0" align="left">
<font style="font-size:27px" color="#000000" face="Arial"><b>Engilsh Quiz:</b></font></div>
<div id="bv_Text2" style="position:absolute;left:0px;top:52px;width:500px;height:16px;z-index:1" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['QN']; echo ". "; echo $row['Q']; ?></font></div>
<form action="evalution.php" method='POST'>
<input type="radio" id="RadioButton1"" name="Q" value="A" style="position:absolute;left:0px;top:78px;z-index:2">
<input type="radio" id="RadioButton2"" name="Q" value="B" style="position:absolute;left:0px;top:110px;z-index:3">
<input type="radio" id="RadioButton3"" name="Q" value="C" style="position:absolute;left:0px;top:142px;z-index:4">
<input type="radio" id="RadioButton4"" name="Q" value="D" style="position:absolute;left:0px;top:175px;z-index:5">
<input type="submit" name="submit" value="Submit" style="position:absolute;left:39px;top:216px;width:75px;height:24px;z-index:10">
</form>
<div id="bv_Text3" style="position:absolute;left:33px;top:78px;width:201px;height:16px;z-index:6" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['A']; ?></font></div>
<div id="bv_Text4" style="position:absolute;left:33px;top:110px;width:201px;height:16px;z-index:7" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['B']; ?></font></div>
<div id="bv_Text5" style="position:absolute;left:33px;top:142px;width:201px;height:16px;z-index:8" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['C']; ?></font></div>
<div id="bv_Text6" style="position:absolute;left:33px;top:176px;width:201px;height:16px;z-index:9" align="left">
<font style="font-size:13px" color="#000000" face="Arial"><? echo $row['D']; ?></font></div>
</body>
</html>
<?
sleep(10);
}
?>
Please help me what i need to change?
Looks like you are trying to use PHP as a client-side script, not possible. You will need to add Javascript or buttons to new pages to reload the questions as PHP is server-side and is compiled to HTML before being sent to the client.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
![]() |
Similar Threads
- Dot Net programmer wanted. Work from home. (Web Development Job Offers)
- Tricks and riddles in C and C++ (C++)
Other Threads in the PHP Forum
- Previous Thread: Good MySQL/PHP tutorial
- Next Thread: time spent by visitor(time difference)
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link links login mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube





