Tusserte
09-20-2007, 06:05 PM
Hello everyone, I have a question about a very basic form I've set up. I'm trying to get the hang of SQL select, but I first need to put some content in my SQL tables! For now, here is the code I've used:
The form on the page:
<form action="testform.php" method="post">
<input type="text" name="title" value="Game Title">
<input type="text" name="esrb" value="ESRB Rating">
<input type="Submit" value="Submit Title">
</form>
The testform.php file:
<?
$username="edited";
$password="edited";
$database="edited";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$title=$_POST['title'];
$esrb=$_POST['esrb'];
$query="INSERT INTO game_titles (gameID,gametitle,esrbrating) VALUES(DEFAULT,$title,$esrb)";
mysql_query($query);
echo "It worked."
?>
For some reason, the output isn't written into the correct tables? What's wrong here? Thanks!
The form on the page:
<form action="testform.php" method="post">
<input type="text" name="title" value="Game Title">
<input type="text" name="esrb" value="ESRB Rating">
<input type="Submit" value="Submit Title">
</form>
The testform.php file:
<?
$username="edited";
$password="edited";
$database="edited";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$title=$_POST['title'];
$esrb=$_POST['esrb'];
$query="INSERT INTO game_titles (gameID,gametitle,esrbrating) VALUES(DEFAULT,$title,$esrb)";
mysql_query($query);
echo "It worked."
?>
For some reason, the output isn't written into the correct tables? What's wrong here? Thanks!