Script and errors to follow any help much appreciated
<body>
<?php
$db = mysql_connect("localhost","root","root");
mysql_select_db("locator",$db);
if ($submit) {
if ($id) {
$sql = "UPDATE year SET surname='$surname',forename='$forename',year='$year',register='$register',mon1='$mon1',mon2='$mon2',mon3='$mon3',mon4='$mon4',mon5='$mon5',mon6='$mon6' WHERE id=$id";
} else {
$sql = "INSERT INTO year (surname,forename,year,register,mon1,mon2,mon3,mon4,mon5,mon6) VALUES ('$surname','$forename','$year','$register','$mon1','$mon2','$mon3','$mon4','$mon5','$mon5','$mon6')";
}
$result = mysql_query($sql);
echo "Record updated/edited!<p>";
} elseif ($delete) {
$sql = "DELETE FROM year WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Record deleted!<p>";
} else {
if (!$sid) {
$result = mysql_query("SELECT * FROM year",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a> \n", $PHP_SELF, $myrow["id"], $myrow["surname"], $myrow["forename"]);
printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]);
}
}
?>
<p>
<a href="<?php echo $PHP_SELF?>">ADD A RECORD</a>
<p>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
if ($id) {
$sql = "SELECT * FROM year WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$surname = $myrow["surname"];
$forename = $myrow["forename"];
$year = $myrow["year"];
$register = $myrow["register"];
$mon1 = $myrow["mon1"];
$mon2 = $myrow["mon2"];
$mon3 = $myrow["mon3"];
$mon4 = $myrow["mon4"];
$mon5 = $myrow["mon5"];
$mon6 = $myrom["mon6"];
?>
<input type=hidden name="id" value="<?php echo $id ?>">
<?php
}
?>
Surname:<input type="Text" name="surname" value="<?php echo $surname ?>"><br>
Forename:<input type="Text" name="forename" value="<?php echo $forename ?>"><br>
Year:<input type="Text" name="year" value="<?php echo $year ?>"><br>
Register Class:<input type="Text" name="register" value="<?php echo $register ?>"><br>
Monday Period 1:<input type="Text" name="mon1" value="<?php echo $mon1 ?>"><br>
Monday Period 2:<input type="Text" name="mon2" value="<?php echo $mon2 ?>"><br>
Monday Period 3:<input type="Text" name="mon3" value="<?php echo $mon3 ?>"><br>
Monday Period 4:<input type="Text" name="mon4" value="<?php echo $mon4 ?>"><br>
Monday Period 5:<input type="Text" name="mon5" value="<?php echo $mon5 ?>"><br>
Monday Period 6:<input type="Text" name="mon6" value="<?php echo $mon6 ?>"><br>
<input tpye="Submit" name="Submit value="Enter Information"
</form>
<?php
}
?>
</body>
errors as reported by browser:
Notice: Undefined variable: submit in c:\inetpub\wwwroot\locate.php3 on line 6
Notice: Undefined variable: delete in c:\inetpub\wwwroot\locate.php3 on line 14
Notice: Undefined variable: sid in c:\inetpub\wwwroot\locate.php3 on line 19
Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\locate.php3 on line 22
Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\locate.php3 on line 23
Notice: Undefined variable: id in c:\inetpub\wwwroot\locate.php3 on line 33
<br /><b>Notice</b>: Undefined variable: surname in <b>c:\inetpub\wwwroot\locate.php3</b> on line <b>53</b><br />
<br /><b>Notice</b>: Undefined variable: forename in <b>c:\inetpub\wwwroot\locate.php3</b> on line <b>54</b><br />
<br /><b>Notice</b>: Undefined variable: year in <b>c:\inetpub\wwwroot\locate.php3</b> on line <b>55</b><br />
<br /><b>Notice</b>: Undefined variable: register in <b>c:\inetpub\wwwroot\locate.php3</b> on line <b>56</b><br />
<br /><b>Notice</b>: Undefined variable: mon1 in <b>c:\inetpub\wwwroot\locate.php3</b> on line <b>57</b><br />
the last messages apears for all day names form mon1 to mon6 with the appropriate names
any help much appreciated i can C any probs with the script my self