Hey can anyone help me out? I am a bit of an amatuer at this. Here is my
problem:
I have an SQL table with a three fields in it. They are ClassTitle,
InstructorName, and CourseDescription. I am setting up a table that lists
the records with a check box in front of it. Then if the user checks the
box, it will give him access to that data(which I have set up in a separate
table). The problem is that I don't know how to name the check box, since
it goes through a while loop. I want the user to be able to check more than
one box, if it is neccessary. But I don't know how to name the check boxes
uniquely (one check box for each record in the table), so that once they are
checked, I can work with it later on the next page. I have inserted a chunk
of the code I am working on for it. Please help me if you can. Thanks.
if (!mysql_connect($dbserver, $dbusername, $dbpassword)) {
print 'Could not connect to mysql';
exit;
}
$result = mysql_list_tables($dbname);
if (!$result) {
print "DB Error, could not list tables\n";
print 'MySQL Error: ' . mysql_error();
exit;
}
mysql_free_result($result);
$CourseInfo = mysql_query("SELECT * FROM $TableName");
while ($row=mysql_fetch_assoc($CourseInfo)) {
echo "<tr>
<td width='3%' style='border-style: none; border-width: medium'>
<input type='checkbox' name='$CourseCheck' value='ON'></td>
<td width='7%' style='border-style: none; border-width: medium'>
<p align='right'><b><font color='#800000'>Course:</font></b></td>
<td width='18%' style='border-style: none; border-width: medium'
colspan='2'>
<p align='center'><font color='#111111'>";
echo $row["ClassTitle"];
echo "</font></td>
<td width='8%' style='border-style: none; border-width: medium'
colspan='2'>
<b><font color='#800000'>Instructor:</font></b></td>
<td width='15%' style='border-style: none; border-width: medium'>
<p align='left'>";
echo $row["InstructorName"];
echo "</td>
<td width='15%' style='border-style: none; border-width: medium'>
<b><font color='#800000'>Course Description:</font></b></td>
<td width='36%' style='border-style: none; border-width: medium'
colspan='2'>
<p align='center'>";
echo $row["CourseDescription"];
echo "</td>
</tr>
<tr>
<td width='100%' style='border-style: none; border-width: medium'
colspan='10'>
</td>
</tr>
<tr>";
}
Thanks,
Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php