It cannot display correct id no of student.
Would you mind tell me what wrog of it.
Thank you very much!

<?php require_once('Connections/connection.php'); ?>
<?php
$colname_Recordset1 = "-1";
if (isset($_GET['eca_id'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['eca_id'] : addslashes($_GET['eca_id']);
}
mysql_select_db($database_connection, $connection);
$query_Recordset1 = sprintf("SELECT * FROM eca,student_info WHERE eca_id = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $connection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="print_enrollment.php">
  <label>  </label>
  <table width="548" height="115" border="1">
    <tr>
      <td width="61"><div align="center"></div></td>
      <td colspan="3"><div align="center">Student Name </div></td>
    </tr>
    
      <?php do { ?>
        <tr><td>
          <div align="center">
            <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row_Recordset1['student_e']; ?>" />
          </div></td>
        <td width="243"><div align="center"><?php echo $row_Recordset1['student_e']; ?></div></td>
        <td width="116"><div align="center">id:
          <input name="id[]" type="text" id="id[]" value="<?php echo $row_Recordset1['id']; ?>" />
        </div></td>
        <td width="100"><div align="center">eca id:
          <label>
          <input name="eca_id[]" type="text" id="eca_id[]" value="<?php echo $row_Recordset1['eca_id']; ?>" />
          </label>
</div></td>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></tr>
  </table>
  <p>
    <input type="submit" name="Submit" value="Submit" />
    <label>
    <input name="Reset" type="reset" id="Reset" value="Reset" />
    </label>
  </p>
  <label></label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>Untitled Document</title>
</head>

<body>
<?php

/* This page receives and handles the data generated by "form.html". */

// $_POST["FirstName"] is an array!!
$total = count($_POST["checkbox"]);
// print "Number of FirstName(s) submitted: " . total;

for ($i=0; $i<$total; $i++) {
if(isset($_POST["Submit"])){
$fruit=isset($_POST["checkbox"]["0"])?$_POST["checkbox"]["0"]:"";
  if(isset($_POST["checkbox"]["$i"]))
  {
  if(!empty($fruit))
  $fruit.=", ";
  $fruit.=$_POST["checkbox"]["$i"];
  }
 } 
   // Note: The FirstNames are stored as 
   //       $_POST["FirstName"]["0"],  $_POST["FirstName"]["1"],  etc
   print "ID: " . $_POST["id"][$i] . ".<BR>\n";
   print "ECA_ID: " . $_POST["eca_id"][$i]. ".<BR>\n";  
   print "Your name is " . $_POST["checkbox"]["$i"] . ".<BR>\n"; 

}
?>
</body>
</html>

I see your new to daniweb and all but could you please explain in a little more detail. I mean like a paragraph of english with only small code snippets that demonstrate the problem instead of the entire source. I'll be waiting for the second post in the morning but until then I don't even know what the question is or where the problem is.

I see your new to daniweb and all but could you please explain in a little more detail. I mean like a paragraph of english with only small code snippets that demonstrate the problem instead of the entire source. I'll be waiting for the second post in the morning but until then I don't even know what the question is or where the problem is.

I want the printenrollment.php page can print out student id,activity id and student name. However, It print out a wrong student id(order by 1,2,3). Therefore i think that it much be something wrong of prgrame.

for ($i=0; $i<$total; $i++) {
if(isset($_POST["Submit"])){
$fruit=isset($_POST["checkbox"]["0"])?$_POST["checkbox"]["0"]:"";
  if(isset($_POST["checkbox"]["$i"]))
  {
  if(!empty($fruit))
  $fruit.=", ";
  $fruit.=$_POST["checkbox"]["$i"];
  }
 } 
   // Note: The FirstNames are stored as 
   //       $_POST["FirstName"]["0"],  $_POST["FirstName"]["1"],  etc
   print "ID: " . $_POST["id"][$i] . ".<BR>\n";
   print "ECA_ID: " . $_POST["eca_id"][$i]. ".<BR>\n";  
   print "Your name is " . $_POST["checkbox"]["$i"] . ".<BR>\n"; 

}

It seems to be pretty correct but is it just the order that they are in which is incorrect or is it something else?

It seems to be pretty correct but is it just the order that they are in which is incorrect or is it something else?

No.

No.

Could you please elaborate on that. Is it that you want to order by the $_POST or what exactly is it you want done because it is hard to see what the problem is.