Hello everyone.I`m new around here and am looking for a bit of help.
I have to make a small project using mysql php.I have to create a web application that allows to add show modify delete datas from the table.
i did most of this project but i have a small problem.When i want to add a new student to the table in the textboxes it appears something like:
<br /> <b>Notice</b>: Undefined variable: row in <b>D:\wamp\www\edit.php</b> on line <b>27</b><br /> and line 31,35
.What i wrote is:
<?php
$ID = $_GET["ID"];
if(trim($ID) != "new"){
$connection = mysql_connect("localhost","root")
or die("Can not connect to database.");
$db = mysql_select_db("new", $connection) or die("Can't select database.");
$result = mysql_query("SELECT * FROM`information`",$connection)
or die("Can't query table.");
$row = mysql_fetch_assoc($result);
}
?>
<html>
<head>
<title>Information students - Edit</title>
</head>
<body>
<body bgcolor="yellow">
<h1>Edit data</h1>
<form method="GET" action="submit.php">
<input type="hidden" name="uid" value="<?php echo $ID;?>">
<table border="1">
<tr>
<td>Name</td>
<td><input name="name" value="<?php echo $row["name"]; ?>"></td>
</tr>
<tr>
<td>year</td>
<td><input name="year" value="<?php echo $row["year"]; ?>"></td>
</tr>
<tr>
<td>Grade</td>
<td><input name="grade" value="<?php echo $row["grade"]; ?>"></td>
</tr>
<?php
if(trim($ID) != "new"){
mysql_close();
}
?>
</table>
<input type="submit" name="submit" value="OK" />
</form>
</body>
</html>