This is the first page, it opens up ok:
<html>
<head>
<title>myMP3db</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("music",$db);
$result = mysql_query("SELECT * FROM mp3s",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td><b>Artist</b></td><td><b>Song</b></td></tr>\n";
do {
printf("<tr><td>%s</td><td>%s</tr>\n", $myrow["Artist"], $myrow["Song"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}
?>
<?php
printf("<a href=\"addentry.php\">Add Entry</a>");
?>
</body>
</html>
Now when I click on the "Add Entry Link", it should take me to this page.. here's the code for that one:
<html>
<head>
<title>Add Entry to Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("music",$db);
$sql = "INSERT INTO mp3s (Artist, Song) VALUES ('$Artist','$Song')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
Artist:<input type="Text" name="Artist"><br>
Song:<input type="Text" name="Song"><br>
<input type="Submit" name="submit" value="Add Entry">
</form>
<?php
} // end if
?>
</body>
</html>
Thanks for your help on this one, I'm really not sure why it's giving me the error. I'll update you if I have any progress.. thanks all.