Hi, the tables display ok but nothing happens when the "Add" button is clicked.
The new album should appear at the bottom of the list?
The new album should appear at the bottom of the list?
Code:
<HTML>
<BODY>
Album Database ADDING Albums BY Names ETC
<TABLE BORDER="0">
<FORM METHOD="GET">
<TR><TD>name</TD><TD><input type="text"name="name"></TD></TR>
<TR><TD>band</TD><TD><input type="text"name="band"></TD></TR>
<TR><TD>sold</TD><TD><input type="text"name="sold"></TD></TR>
<TR><TD>genre</TD><TD><input type="text"name="genre"></TD></TR>
<TR><TD>country</TD><TD><input type="text"name="country"></TD></TR>
<TR><TD>year</TD><TD><input type="text"name="year"></TD></TR>
<TR><TD>order</TD><TD><input type="text"name="order"></TD></TR>
<TR><TD><input type="submit"value="Add" name="Submit"></TD><TD><input type="Reset" value="Reset" name="Reset"></TD></TR>
</Form>
</Table>
<?php
$link=mysql_connect("localhost","root");
$db=mysql_select_db("patsmusic",$link);
if(isset($_GET["name"]))
{
$sql="INSERT INTO allthemusic(album_id,name,band,sold,genre,country,year,order)VALUES('','".$_GET["name"]."','".$_GET["band"]."','".$_GET["sold"]."','".$_GET["genre"]."','".$_GET["country"]."','".$_GET["year"]."','".$_GET["order"]."')";
$result=mysql_query($sql,$link);
}
?>
<TABLE BORDER="1">
<TR><TD>name</TD><TD>sold</TD><TD>country</TD><TD>year</TD></TR>
<?php
$sql="SELECT*FROM allthemusic";
$result=mysql_query($sql,$link);
while($row=mysql_fetch_object($result))
{
print("<TR><TD>$row->name</TD><TD>$row->sold</TD><TD>$row->country</TD><TD>$row->year</TD></TR>\n");
}
?>
</TABLE>
</BODY>
</HTML>
Comment