<html>
<head>
<title>Eastern Mediterranean University-Student's ID</title>
</head>
<body>
<h3>Edit Student</h3>
<?php
include("sonuc.php");
if(!isset($_POST['edit'])) {
$num = $_GET['num'];
$sql = "select * from students where num='$num'";
$result = mysql_query($sql) or die('\"'.$sql.'\" Query failed:'.mysql_error());
$row = mysql_fetch_array($result, MYSQL_BOTH);
$id = $row['id'];
$name = $row['name'];
$surname = $row['surname'];
$department = $row['department'];
$cpa = $row['cpa'];
}
else {
$num = $_POST['num'];
$id = $_POST['id'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$department = $_POST['department'];
$cpa = $_POST['cpa'];
$sql = "update students set id='$id', name='$name', surname='$surname', department='$department', cpa='$cpa' where num='$num'";
$result = mysql_query($sql) or die ('\"'.$sql.'\" Query failled: '.mysql_error());
echo"<br><br>The student has been succesfully updated.<br><br>\n";
}
?>
<form method="post" action="edit.php" >
<input type="hidden" name="num" value="<?php echo $num ?>">
<b>ID:</b><br>
<input type="text" name="id" value="<?php echo $id ?>" size="10">
<br>
<b>Name:</b><br>
<input type="text" name="name" value="<?php echo $name ?>" size="10">
<br>
<b>Surname:</b><br>
<input type="text" name="surname" value="<?php echo $surname ?>" size="10">
<br>
<b>Department:</b><br>
<input type="text" name="department" value="<?php echo $department ?>" size="10">
<br>
<br>
<b>GPA:</b><br>
<input type="text" name="cpa" value="<?php echo $cpa ?>" size="10">
<br>
<br>
<input type="submit" name="edit" value="Update information">
</form>
</body>
</html>
it doesn't working.. what is my problem?
thank you for helps :)