A very simple script
Contents of file start.html:
Contents of file finish.php:
mysql_connect("xxx.domain.com", "user_name", "user_password");
$db = mysql_select_db("database");
$sql = "INSERT INTO table VALUES('" . $POST['firstname'] . "')";
$result = mysql_query($sql);
echo "Thank you " . $POST['firstname'] . ", your name has been added to the database";
echo "Your name have not been added!";
Using a little common sense you should be able to understand that. But I recommend looking for more examples.
You can try www.w3schools.com too for lots of tutorials on different languages.