Help....if you can!
Posted: Fri Nov 05, 2004 1:37 pm
I am trying to create a simple HTML form that calls a .php script called submitter. Submitter should then put the values into my database called test. The HTML code is:
<html>
<body>
<form method="post" action="submitter.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Int" name="age"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
and the php script:
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("test",$db);
$sql = "INSERT INTO test (FirstName,LastName,Age) VALUES ('$first','$last','$age')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
?>
All this does is put nothing into the database. When i display the database using a seperate php script it just shows 0??
Any ideas?
<html>
<body>
<form method="post" action="submitter.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Int" name="age"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
and the php script:
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("test",$db);
$sql = "INSERT INTO test (FirstName,LastName,Age) VALUES ('$first','$last','$age')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
?>
All this does is put nothing into the database. When i display the database using a seperate php script it just shows 0??
Any ideas?