After figuring out my previous problem with help, now, one of my other forms is not working. The following code:
is inserting "blank" data (where it should be a name) into my database under table user column name.
It was working before, but now its not working. All I get is a blank where the new user's name should be.
Code:
<html>
<?php
$db = mysql_pconnect("localhost", "root");
@mysql_select_db("accessories",$db) or die(mysql_error());
if ($submit) {
// process form
$sql = "INSERT INTO user (name) VALUES ('$name')";
$result = mysql_query($sql) or die(mysql_error().$sql);
echo "Thank you! Information entered. Click <a href=admin.php>here</a> to go back.\n";
}
else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF; ?>">
<table width=40%>
<tr>
<td>Name</td>
<td><input type="Text" name="name" size="25" maxlength="50"></td>
</tr>
</table>
<input type="submit" name="submit" value="Enter User">
</form>
<?php
} // end if
?>
</body>
</html>
is inserting "blank" data (where it should be a name) into my database under table user column name.
It was working before, but now its not working. All I get is a blank where the new user's name should be.