hi guys,
I am in the process of making an online survey system. The system has a library with a list of pre developed surveys from a mysql database. Once the user has selected the survey they want from the drop down box, the questions and multiple choice options for that survey appear on-screen.
I have coded the drop down box to get data from mysql and the correct questions and options appear. However, i would like 5 radio boxes to appear after each question, and for the option names to appear with these.
So far, i have only managed to get the options to appear once....at the bottom of the page. I am assuming some sort of loop of if statement may be needed.
I have attached the code. Really hope somebody can help with this...
I am in the process of making an online survey system. The system has a library with a list of pre developed surveys from a mysql database. Once the user has selected the survey they want from the drop down box, the questions and multiple choice options for that survey appear on-screen.
I have coded the drop down box to get data from mysql and the correct questions and options appear. However, i would like 5 radio boxes to appear after each question, and for the option names to appear with these.
So far, i have only managed to get the options to appear once....at the bottom of the page. I am assuming some sort of loop of if statement may be needed.
I have attached the code. Really hope somebody can help with this...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Edit Survey</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <div id="logo"> <h1><p></p> Edit Survey</p></h1> <p>The first answer to a successful website!</p> </div> <div id="menu"> <ul> <li class="current_page_item"><a href="#"> </a></li> <li><a href="#"> </a></li> <li><a href="#"> </a></li> <li><a href="About_Us.php"> About Us </a></li> <li><a href="Contact_Us.php"> Contact Us</a></li> </ul> </div> <!-- end header --> <!-- Start Login --> <div id="latest-post" class="wide-post"> <h4 class="title"> <font color="maroon"> <p> <?php require_once ('Connect.php'); $survey = $_POST ['survey']; $res = mysql_query("SELECT * FROM survey WHERE Survey_ID = '$survey'")or die(mysql_error()); $numRows = mysql_num_rows($res); while($row = mysql_fetch_array($res)) { echo $row['Survey_Name']; } ?> </p> </font> </h4> <div class="entry"> <br /> <font size="2"> <p align="left"> <strong> <i> We are continuously improving our website to make it as useful to you as possible. Please take a few moments </p> <br /> <p> to answer these questions about our site. </strong> </i> </p> </font> <br /> <br /> <br /> <p> <?php $survey = $_POST['survey']; $table1="survey_and_question"; $table2="questions"; $res = mysql_query("SELECT * FROM $table1, $table2 WHERE $table1.Question_ID = $table2.Question_ID AND $table1.Survey_ID = '$survey'")or die(mysql_error()); $numRows = mysql_num_rows($res); while($row = mysql_fetch_array($res)) { echo $row['Question_Text']; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; } $table3="question_and_option"; $table4="options"; $res = mysql_query("SELECT * FROM $table3, $table4 WHERE $table3.Option_ID = $table4.Option_ID")or die(mysql_error()); $numRows = mysql_num_rows($res); while($row = mysql_fetch_array($res)) { echo "<strong>"; echo $row['Option_Text']; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "</strong>"; } ?> <form name=myform> <input type="radio" name=myradio value= <?php echo $_POST ['Option_Text'];?> <input type="radio" name=myradio value= <?php echo $_POST ['Option_Text'];?> </form> </p> <br /> <br /> <form action="display_library.php" method="POST"> <br /> <p> <center> <p align="center"><input name="submit" type="submit" id="submit" value="Distribute Survey" /> <input type="hidden" name="submitted" value="TRUE" /> </p> </center> </form> </div> <div class="bottom"></div> </div> <div id="footer"> <p>©2009 All Rights Reserved. • FirstCheck Enterprises • Designed by Sejal Modi </p> </div> </body> </html>
Comment