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>