Thanks for the suggestion.  I tried that too, but still no luck.  I don't
know what I am doing wrong here.  I had the form tag at the top of the page,
so it will pass the variables to the next page.  It passes all the variables
except the check boxes to the next page.  This is what I changed it to:

if (!mysql_connect($dbserver, $dbusername, $dbpassword)) {
        print 'Could not connect to mysql';

    $result = mysql_list_tables($dbname);

    if (!$result) {
        print "DB Error, could not list tables\n";
        print 'MySQL Error: ' . mysql_error();


$CourseInfo = mysql_query("SELECT * FROM eClassRoom_InstructorInfo");
while ($row=mysql_fetch_assoc($CourseInfo)) {
echo "<tr>
    <td width='3%' style='border-style: none; border-width: medium'>
    <input type='checkbox' name='CheckBox[$counter]' 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'
    <p align='center'><font color='#111111'>";
echo $row["ClassTitle"];
echo "</font></td>
    <td width='8%' style='border-style: none; border-width: medium'
    <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'
    <p align='center'>";
echo $row["CourseDescription"];
echo "</td>
<td width='100%' style='border-style: none; border-width: medium'

Then on the next page, this is how I try to output it, but it doesn't work:

for($i=0; $i < $counter; $i++) {
echo $CheckBox[$i];
echo "<br>";

I just can't get it to work, and I have been trying for hours.  You
mentioned printing out Globals or something.  I am relatively new to this,
so I don't really know how to do that.  I would really appreciate more help.


"Jason Wong" <[EMAIL PROTECTED]> wrote in message
> On Friday 31 January 2003 11:40, Matt Palermo wrote:
> > Thanks.  I tried that, and maybe I am doing something wrong with it, but
> > it didn't work.  What I did was I made a counter variable, $counter and
> > put it outside the while loop.  Then, inside the while loop, when it
> > makes a checkbox, I named the check box, $CheckBox[$counter], so that it
>                                            ^^^^^^^^^
> That should be CheckBox and not $CheckBox (that latter, as per your code,
> undefined and is empty).
> > would put it at that spot in an array.  Then on the following page
> > (which the variables get posted to) I created a for loop to output all
> > the values of $CheckBox[].  I made the loop from 0 to < $counter, and it
> > still doesn't output anything.
> *********************************************
> * "If in doubt, print everything out" (TM). *
> *********************************************
> print_r($GLOBALS) should give you all you need to know.
> Or more specifically, to find out what values your forms are returning you
> use:
>     print_r($_POST)
> or
>     print_r($_GET)
> depending on the 'method' that your form uses.
> And whilst we're on the subject, you don't seem to have any <form> tags?
> browsers (quite rightly) ignore form elements if there are no <form> tags.
> > Do I need to initialize the $CheckBox
> > array or something, if so, how do I do it?
> No.
> >  Here is the modified code
> > that I used for this:
> [snip]
> >     <input type='checkbox' name='$CheckBox[$counter]' value='ON'></td>
> That should be:
>   ... name='CheckBox[$counter]' ...
> --
> Jason Wong -> Gremlins Associates ->
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> /*
> 1 1 was a race-horse, 2 2 was 1 2. When 1 1 1 1 race, 2 2 1 1 2.
> */

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to