If anyone could help that would be great!
Admin Edit: Added
Code: Select all
Code: Select all
<html>
<head><title>Submit form For Album Titles</title></head>
<body text="#000000" bgcolor="#feebcc">
<style type="text/css">
body { margin-left: 10%; margin-right: 10%; }
</style>
<center><img src="unicrest.gif" width="154" height="79"
alt="University crest of Liverpool" longdesc="unicrest.html"></center>
<HR SIZE=3 style="background-color: blue">
<body>
<font face = "verdana">
<font size=4>
<center>
<a href = "http://www.csc.liv.ac.uk/~u1phg/UserLogin.php">
Home Page
</a>
</center>
<center>
<a href = "http://www.csc.liv.ac.uk/~u1phg/ContactPage.html">
Contact Page
</a>
</center>
<center>
<a href = "http://www.csc.liv.ac.uk/~u1phg/InfoPage.html">
Information Page
</a>
</center>
</font size=4>
<h2>Submitting Of Album Title</h2>
<h3>Fields shown in <font color="red">red</font> are mandatory.</h3>
<?php
$user="u1phg";
$host="mysql";
$password="";
$database="u1phg";
$connection = mysql_connect($host,$user,$password) or die ("connection to server failed.");
$db=mysql_select_db($database,$connection) or die ("could not connect to database");
$albumId=$HTTP_POST_VARS['albumId'];
$albumTitle=$HTTP_POST_VARS['albumTitle'];
$classicalTrack=$HTTP_POST_VARS['classicalTrack'];
$cdNumber=$HTTP_POST_VARS['cdNumber'];
$artistBandName=$HTTP_POST_VARS['artistBandName'];
$genre=$HTTP_POST_VARS['genre'];
$label=$HTTP_POST_VARS['label'];
$year=$HTTP_POST_VARS['year'];
$rating=$HTTP_POST_VARS['rating'];
// if any of the follwoing variables are empty do not insert into database
if(!empty($albumId) and (!empty($albumTitle)) and (!empty($artistBandName)) and (!empty($genre)) and (!empty($year)) and (!empty($rating)) ) {
$query = "INSERT INTO Album(albumId,AlbumTitle,classicalTrack,cdNumber,artistBandName,genre,label,year,rating)
VALUES('$albumId','$albumTitle','$classicalTrack','$cdNumber','$artistBandName','$genre','$label','$year', '$rating')";
$result = mysql_query($query) or die ("Execution failed.");
}else {
echo " Make sure all the fields are entered!";
}
?>
<form method="post"action="<?php echo $PHP_SELF?>">
<table cellpadding=2 cellspacing=0 border=0>
<td><font color="red">Album Id :</font></td><td> <input type="text" size="5" maxlength="10" name="albumId" value="<?echo $albumId; ?>"></td><tr>
<td><font color="red">Album Title:</font></td><td> <input type="text" size="30" maxlength="30" name="albumTitle" value="<?echo $albumTitle; ?>"></td></tr>
<td>Classical Track:</td><td> <input type="text" size="30" maxle2th="30" name="classicalTrack"value="<?echo $classicalTrack;?> "></td></tr>
<td>Cd Number:(same as Album ID)</td><td> <input type="text" size="2" maxlength="2" name="cdNumber" value="<?echo $cdNumber;?>"></td></tr>
<td><font color="red"> Artist / Band Name:</font></td><td> <input type="char" size="30" maxlength="30" name="artistBandName" value="<?echo $artistBandName;?>"> </td><tr>
<td><font color="red"> Genre:(e.g pop, rock, R &B...)</font> </td><td> <input type="char" size="20" maxlength="20" name="genre" value="<?echo $genre;?>"></td><tr>
<td>Label:</td><td> <input type="char" size="20" maxlength="20" name="label" value="<?echo $label;?>"></td><tr>
<td><font color="red">Year (e.g.yyyy-mm-dd):</font></td><td> <input type="char" size="10" maxlength="10" name="year"value="<?echo $year;?>"></td><tr>
<td><font color="red">Rating:(e.g use- bad, ok, good, great)</font></td><td> <input type="char" size="10" maxlength="10" name="rating" value="<?echo $rating;?>"></td><tr>
</table>
<input type="Submit" name="class" value="Enter Album Title Info.">
<input type="Reset">
</form>
<br> </br>
<p>You Can view the updated General Music Collection with information that you have entered <a href = "http://www.csc.liv.ac.uk/~u1phg/selectAlbum.php"> - Here!</a></p>
<br> </br>
<center><p>To submit or query the other collections choose from below:</p></center>
<center><p> <a href = "http://www.csc.liv.ac.uk/~u1phg/IntroClassicalAlbum.php">Classical Music</a></p>
<p> <a href = "http://www.csc.liv.ac.uk/~u1phg/introDVD.php">DVDs</a></p>
<p> <a href = "http://www.csc.liv.ac.uk/~u1phg/introBookTitle.php">Books</a></p></center>