Hi.. I'm kinda new to PHP..
I've been looking at a place on the net that had a few lessons in basic php/mysql but nothing there worked. I mean, some stuff worked, but not the stuff I wanted.
I just simply want to be able to insert data into a database through a simple form...
this is what I get from what they told me:
-------------------------------------------------------------
<?php
if ($submit) {
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
-------------------------------------------------------------
what's wrong with it?
and if nothings wrong with the code, what else could be messed up?
what happens is that the form shows, I ender data into the fields and press submit and the fields go blanc.
the "thank you" message don't show and when I check the database nothing has been entered.
I'd be glad for any help at all...
thanks


