pcchella 0 Newbie Poster

Hi,
If i select first checkbox, usually first record is selected. but here last record is selected. This is my problem. Kindly solve this problem.

Chella.

<!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>
<title>Revaluation : Sona College of Technology</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>

<div id="container">

<?php
// Make a MySQL Connection
$username="root";
$password="krish";
$database="test";

$con=mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM name where id=1 AND grade='RA' AND revaluation != 500"; 
	 
$result = mysql_query($query) or die(mysql_error());

$num=mysql_num_rows($result);
//$row = mysql_fetch_array($result) or die(mysql_error());
?>
<table><tr><td>id</td><td>name</td><td>subject</td><td>revaluation</td></tr>
<?php

$i=0;

while($i < $num) {

$f1=mysql_result($result,$i,"id");
$f2=mysql_result($result,$i,"name");
$f3=mysql_result($result,$i,"title");
$f4=mysql_result($result,$i,"grade");
$f5=mysql_result($result,$i,"results");
$f6=mysql_result($result,$i,"dept");
$f7=mysql_result($result,$i,"revaluation");
$f8=mysql_result($result,$i,"courseid");

?>
<form action="test.php" method="post">
<tr><td>
<input type="hidden" name="register" value="<?php echo $f1; ?>" /><?php echo $f1; ?><br /></td><td>
<input type="hidden" name="name" value="<?php echo $f2; ?>" /><?php echo $f2; ?><br /></td><td>
<input type="hidden" name="course" value="<?php echo $f3; ?>" /><?php echo $f3; ?><br /></td><td><input type="checkbox" name="reval" value="500" /></td></tr><?php
$i++;
}
?><tr><td>


<input type="submit" value="submit" /></td></tr>
</form>

<?php


mysql_close($con);





?>
  </table>
</div>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.