I wrote a code with a form:
<form method="post">
<table>
<tr>
<td style="text-align:right">Artista:</td>
<td><input type="text" name="artist" /></td>
</tr>
<tr>
<td style="text-align:right">Titulo:</td>
<td><input type="text" name="title" /></td>
</tr>
<tr>
<td style="text-align:right">Capa (link):</td>
<td><input type="text" name="cover" /></td>
</tr>
<tr>
<td colspan="2">
<center>
<input type="submit" style="margin-top:20px" />
</center>
</td>
</tr>
</table>
</form>
Then I wrote some php to get the info on form and put it on a mySQL database.
if (isset($_POST['submit'])){
$dbhost = 'HOST';
$dbuser = 'USER';
$dbpass = 'PASS';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$artist = strtoupper($_POST[artist]);
$title = strtoupper($_POST[title]);
$cover = $_POST[cover];
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = "INSERT INTO 'MusicList'('artist', 'title', 'cover', 'votes') VALUES ('".$artist."', '".$title."', '".$cover."', 0)";
mysql_select_db('DATABASE_NAME');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "<center><h1>Success!</h1></center>";
mysql_close($conn);
}
However it seems something has gone wrong because it doesn't write anything on SQL. Can you tell me what did I wrote wrong?