| | |
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 |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





