Hi everyone, can you help me how to add update form in this code?
<html>
<head>
<title>Eastern Mediterranean University-Student's ID</title>
</head>
<body>
<h3>Edit Student</h3>
<?php
$num=$_POST['num'];
@ $db = new mysqli('localhost', 'root', 'ilyas1987', 'dau');
if (mysqli_connect_errno()) {
echo 'Error: Could not connect to database. Please try again.';
exit;
}
$query = "select * from students where num='$num'";
$result = $db->query($query);
$row = $result->fetch_assoc();
echo $query;
echo "<tr>
<form method='post' action='sonuc.php' >
<input type='hidden' name='num' value='$num'>
<b>ID:</b><br>
<input type='text' name='id' value='".$row['id']."' size='10'>
<br>
<b>Name:</b><br>
<input type='text' name='name' value='".$row['name']."' size='10'>
<br>
<b>Surname:</b><br>
<input type='text' name='surname' value='".$row['surname']."' size='10'>
<br>
<b>Department:</b><br>
<input type='text' name='department' value='".$row['department']."' size='10'>
<br>
<b>GPA:</b><br>
<input type='text' name='cpa' value='".$row['cpa']."' size='10'>
<br>
<br>
<input type='submit' name='edit' value='Save'><br>
</form>
</tr><br />\n";
$result->free();
$db->close();
?>
</body>
</html>