|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
collect data
hi there,
My project is about questionnaire. Sorry if you can't understand it very well. After user select a questionnaire title, it will appear the questionnaire question in HTML format. My problem is how to collect the data after the user have answer te question? because i want the data to generate a bar chart just like a "POLL". Thank You very much. Below is my coding to appear a questionnaire question after user had select the questionnaire title. ---------------------------------------------------------------------- <html> <body > <form method="post" action="" name="vq"> <? $connection = mysql_connect("localhost","",""); $pd = mysql_select_db("myEsurvey", $connection); $vqsql = "SELECT * from questionnaire WHERE title='$poll' "; $vqresult=mysql_query($vqsql,$connection); $i=1; while($row=mysql_fetch_object($vqresult)) { echo "<br><br><font face=verdana color=#000000 size=1><b>Soalan-$i :</b><br>$row->question<br><br></font>"; echo "<font face=verdana color=#000000 size=1><b>Jawapan:</b><br><br></font>"; echo "<input type=\"radio\" name=\"A\" value=\"$row->A\">"; echo "<font face=verdana color=#000000 size=1><b>A.</b>$row->A<br></font>"; echo "<input type=\"radio\" name=\"B\" value=\"$row->A\">"; echo "<font face=verdana color=#000000 size=1><b>B.</b>$row->B<br></font>"; echo "<input type=\"radio\" name=\"C\" value=\"$row->A\">"; echo "<font face=verdana color=#000000 size=1><b>C.</b>$row->C<br></font>"; echo "<input type=\"radio\" name=\"D\" value=\"$row->A\">"; echo "<font face=verdana color=#000000 size=1><b>D.</b>$row->D<br></font>"; $i++; } mysql_close(); ?> <input type="submit" name="submit" value="POLL"> </form></body></html> ------------------------------ |
|
#2
|
|||
|
|||
|
inside your <form> tag, you have a action pram, you need to set that to a file, that will process the data.
<form method="post" action="process_poll.php" name="vq"> then in the process_poll.php page, you have access to the variables created by the form |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > collect data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|