I'm trying to learn php and I'm trying to build a simple form that stores data. However, I'm getting this error message when I submit my form:
Parse error: parse error, unexpected T_STRING in /sites/yuma2/swaters210/home/public_html/music/music.php on line 7
you check out my form here: http://www.stevenwaters.net/music/index.html
<?
$artist=$_POST['artist'];
$song=$_POST['song'];
$album=$_POST['album'];
mysql_connect("localhost", "swaters210", "password") or die(mysql_error());
mysql_select_db("swaters210") or die(mysql_error());
CREATE TABLE data (artist VARCHAR(30), song VARCHAR(30), album VARCHAR(30));
mysql_query("INSERT INTO `data` VALUES ('$artist', '$song', '$album')");
Print "Your information has been successfully added to the database.";
?>
FYI: I do know I have to replace password with an actual password, which I have.
<form method="POST" action="music.php">
<label for="artist"><b>Artist Name:</b></label>
<input type="text" name="artist" value="" /><br />
<label for="song"><b>Song Title:</b></label>
<input type="text" name="song" value="" /><br />
<label for="album"><b>Album:</b></label>
<input type="text" name="album" value="" /><br />
<input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
Can someone check it out for me? I would appreciate it. I was going to post in a similiar thread, but wasn't sure if anybody would see it.