php - Dynamically Generated Radio button form when submitted does not display data -
i trying create quiz php/mysql...
i have created form radio buttons answers displays data pulled database values radio buttons. tried submit form result page not show anything.
my quiz code goes follows:
<form method="post" action="insertscore.php" name="csscheckbox" id = "csscheckbox">  <?php $query = "select * questions (`topics` = '.net' or `topics` = 'php') order rand() limit 5"; $result = mysql_query($query);  if ($result && mysql_num_rows($result)) {     $numrows = mysql_num_rows($result); $count =1;  while ($row = mysql_fetch_array($result))  {  ?>  <div class="group">  <input type="hidden" name="<?php echo $row['key_id']; ?>"><?php $row['key_id']; ?></input> <span class="test_question"><strong><?php echo $count;?>) <?php echo $row['question']; ?> </strong><br />  <?php   if($row['answer1'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer1']; ?>" id="chklimit_1" ></input> <label for="chklimit_1" ><?php echo $row['answer1']; echo "<br />"; } else {} ?></label>   <?php   if($row['answer2'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer2']; ?>" id="chklimit_2" ></input> <label for="chklimit_2" ><?php  echo $row['answer2']; echo "<br />"; } else {} ?></label>  <?php   if($row['answer3'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer3']; ?>" id="chklimit_3" ></input> <label for="chklimit_3" ><?php  echo $row['answer3']; echo "<br />"; } else {} ?></label>  <?php   if($row['answer4'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer4']; ?>" id="chklimit_4" ></input> <label for="chklimit_4" ><?php  echo $row['answer4']; echo "<br />"; } else {} ?></label>  <?php   if($row['answer5'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer5']; ?>" id="chklimit_5" ></input> <label for="chklimit_5" ><?php  echo $row['answer5']; echo "<br />"; } else {} ?   ></label>  <?php   if($row['answer6'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer6']; ?>" id="chklimit_6" ></input> <label for="chklimit_6" ><?php  echo $row['answer6']; echo "<br />"; } else {} ?></label>  <?php   if($row['answer7'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer7']; ?>" id="chklimit_7" ></input> <label for="chklimit_7" ><?php  echo $row['answer7']; echo "<br />"; } else {} ?></label>   <?php   if($row['answer8'] != null){ ?> <input type = "radio" name="answers" value="<?php echo $row['answer8']; ?>" id="chklimit_8" ></input> <label for="chklimit_8" ><?php  echo $row['answer8']; echo "<br />"; } else {} ?></label>  <input type="hidden" name="<?php echo $row['right_answer']; ?>"><?php   $row['right_answer']; ?></input> </div> <input name="submit" type="submit" value="submit answers" class="submit">  </form> code on submitted page looks like:
<?php  if(isset($_post['submit'])){  $key_id=$_post['key_id']; echo $key_id;  $question=$_post['question']; echo $question;  $answers=$_post['answers']; echo $answers;  $correctanswer=$_post['correctanswer']; echo $correctanswer;  }   foreach($_post $key => $val) { echo "$key --> $val<br />"; }   //var_dump($_post); ?> please let me know if not clear or if missing anything....
thanks,
shank
i would:
- remove comments - //var_dump($_post);, move line @ top of code on submitted page.
- if still don't see anything, think code on submitted page not in file called - insertscore.phpor such file not in same folder of form page.
Comments
Post a Comment