By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

passed information has to display as editable radio button

P: 7
We were given a database which contains the informations of different ratings (1-4). We have to call the informations from the database about the ratings and display them as radio buttons, and to make them editable by the manager. Below is part of my code for the ratings:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $conn1 = mysql_connect("localhost", "TWA", "test");
  3. mysql_select_db("performancereview", $conn1)
  4. or die ('Database not found ' . mysql_error() );
  5.  
  6. $reviewid1 = mysql_real_escape_string($_GET['reviewid']);
  7. $sql1 = "SELECT jobknowledge FROM reviews WHERE reviewid = '$reviewid1' ";
  8. $rs1 = mysql_query($sql1, $conn1)
  9. or die ('Problem with query' . mysql_error());
  10. ?>
  11.  
  12. <?php while($row1 = mysql_fetch_array($sql1)) { ?>
  13.  
  14. <div class="left1"><table class="table1"><tr><td class="width1">
  15. <div class="left"><table class="table2">
  16. <tr>
  17. <td>&nbsp;</td>
  18. <td>1</td>
  19. <td>2</td>
  20. <td>3</td>
  21. <td>4</td>
  22. </tr>
  23. <tr>
  24. <td>Job Knowledge</td>
  25. <td><input type="radio" name="jobKnowledge" value="1"/></td>
  26. <td><input type="radio" name="jobKnowledge" value="2"/></td>
  27. <td><input type="radio" name="jobKnowledge" value="3"/></td>
  28. <td><input type="radio" name="jobKnowledge" value="4"/></td>
  29. </tr>
  30.  
  31. </table></div>
  32. </td></tr></table></div>
  33. <table>
  34. <?php }
  35. mysql_close($conn1); ?> 
I'm not sure how to call the values from the database and display them as the radio button.

The rating for job knowledge in the database is 1, so we have to check the 1st radio button but make it editable.

can anyone please help, thanks.
May 28 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.