I've been having this simple/stupid problem with inputting user info from a form to a MySQL database/table. I do a form with a post and then call $PHP_SELF on submit. when it resubmits it should find the vars submitted in an if/else and insert them. However it never gets that far. The information never passes the submit button.
Here's the code. Its a cross-referencing database.
<?php
if ( isset ( $theirs ) )
{
$db = mysql_connect("localhost", "root");
mysql_select_db("tribology",$db); $query = "INSERT INTO tribo ( their_product, our_product )
values( '$theirs', '$ours' )";
print "thanks";
mysql_close();
}
else {
global $PHP_SELF;
?>
<form action="<?php echo $PHP_SELF ?>" method="POST"><br>
<input name="theirs" type="text">
Their product<p><br>
<input name="ours" type="text">
Our Equivalent<p><br>
<input name="submit" type="submit" id="submit" value="submit"><br></form>
<?php
}
?>
this works without any errors but when you click submit, it just sends you right back to where you started. I've also tried a GET which doesn't work either.