My problem is, I do not know how to set the value of the checkbox to be whatever the SkillID is. I can make a checkbox form using a set value, but because the values are being retrieved from a query, they cannot be hard coded into the query/form. Can anyone help with this? I am totally lost. The skills needing to be updates all display accurately, now I just have to make it so users can do something with them!
Here is some code that may help. This is the code for the form. I know I need more, to process the form input, but here is where I get stuck, as I don't know how to process the input.
Expand|Select|Wrap|Line Numbers
- <?php
- session_start();
- $fname = $_SESSION['fname'];
- $lname = $_SESSION['lname'];
- $username = $_SESSION['username'];
- $user_skillID = $_POST['user_skillID'];
- $ud_userskillID = serialize($_POST['ud_userskillID']);
- $tngdate = date("d-M-y");
- require 'Includes/Header.php';
- require_once('Connections/skillsdb.php');
- ?>
- <html>
- <head>
- <title>Microsoft Access 2007 Skills Listing</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <link href="Includes/si.css" rel="stylesheet" type="text/css" />
- </head>
- <body topmargin="5" leftmargin="0">
- <table width="980" align="center" cellpadding = "0">
- <td>
- <tr>
- <th align="center">
- <b>Microsoft Access 2007 skills for
- <?php
- echo $_SESSION['fname'];
- echo ' ';
- echo $_SESSION['lname'];
- echo ":";
- ?>
- <br/><p>(If no skills appear, there are no skills for you to update.)</p>
- </th>
- </tr>
- </td>
- <tr>
- <td>
- <?php require 'Includes/topicsmenu.php'; ?><br />
- </tr>
- </td>
- </table ><br />
- <table width="800" align="center" border="1">
- <td>
- <tr>
- <th>Skill ID</th>
- <th>Skill Description</th>
- <th>Select Achieved Skill(s)</th>
- </tr>
- </td>
- <?php
- mysql_select_db($database_skills, $skills);
- $query_MySkills = "SELECT user_skills.user_skillID, skills.topic, skills.skill, user_skills.tngdate, user_skills.achieved, users.username, DATE_FORMAT(`tngdate`,'%d-%b-%y') AS tngdate
- FROM skills, users, user_skills
- WHERE users.username = ('$username') AND users.userID=user_skills.userID AND user_skills.achieved != 'N/A' AND user_skills.achieved !='Yes'
- AND user_skills.skillID=skills.skillID
- AND skills.topic = 'Access'
- ORDER BY topic, skill";
- $MySkills = mysql_query($query_MySkills, $skills) or die(mysql_error());
- //$row_MySkills = mysql_fetch_assoc($MySkills);
- $totalRows_MySkills = mysql_num_rows($MySkills);
- $result = mysql_query($query_MySkills, $skills);
- while($row_MySkills = mysql_fetch_assoc($MySkills))
- {
- echo '<tr>';
- echo '<td align="center">' . ($row_MySkills['user_skillID']).'</td>';
- echo '<td align="left"> ' . ($row_MySkills['skill']). '</td>';
- echo '<td <form method="POST" action="changeskillsrecord.php">
- <p align="center"><input type="checkbox" name="user_skillID[]" value="$ud_userskillID">';
- echo '</tr>';
- }
- ?>
- <br /><br />
- <td>
- <td>
- <td>
- <p align="center"><input type="submit" value="Update"></p>
- </form>
- </td>
- </td>
- </td>
- </table>
- </body>
- </html>