It is showing all the students in database and textbox with them. But when I enter marks of every student it picks only the first record and save only marks.
I want:
- all name of student should print on page with text-box in which I will enter marks of each student.
- I want to save the record of every student with their marks.
--
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = "SELECT * FROM stunr WHERE stucou = '".$_POST["cls"]."'";
mysql_select_db('college-db');
$retval = mysql_query( $sql, $conn );
if($retval === FALSE) {
die(mysql_error());
}
$row = mysql_fetch_array($retval);
echo "<div style='margin-top:120px; margin-left:180px;'>";
$cla=$row['stucou'];
echo "<h3>Class"."<b> $cla</b>"."</h3>";
echo"</div>";
echo "<div style='margin-top:50px; margin-left:180px;'>";
while($row = mysql_fetch_array($retval)) {
echo"<form method='post' action='mst-marks-insert.php'>";
$clsnm = $row['stufname'];
echo"$clsnm";
echo "<br>";
echo"<input type='text' name='mas' class='textbox' placeholder='Enter Marks'/><br><br>";
}
echo "<input type='text' name='tot' />";
echo"<input type='submit' />";
echo"</form>";
echo"</div>";
"; ` please pass array to the action page like the above code – Jees K Denny Jul 29 '16 at 15:25