<?
//uses a separate file to hold the db connection info
//good for security
require("dbconn.php");
if(!$submit){
//show form
echo "<html><body><form name=\'test\' action=PHP_SELF
method=\'post\'>
<table><tr><td>input name</td><td>
<input type=\'text\' name=\'yourname\' size = 20>
</td></tr><tr><td><input type=\'submit\'
value=\'submit\'></table></form></body></html>";
}else{
//if the submit button has been pressed then insert the data
//create the sql query
$sql="insert into mytable values($yourname)";
//get the result (confirm insert)
//$conn is the database connection info from the dbconn.php pg
$result = mysql_query($sql, $conn) or die("can't connect");
if (!$result){
echo "insert failed";
}else{
echo "insert successful";
}
}
?>
hth