The form is a simple HTML form, it is the page which actions the form which needs the PHP (it can be the same page). Here is some example PHP code to do the INSERT into the database.
PHP Code:
if ($_POST["adminsubmit"] == "Submit") {
$username = $_POST["username"];
$password = $_POST["password"];
$emailaddr = $_POST["emailaddr"];
$conn = mysql_connect ("localhost","YourMySQLUsername","YourMySQLPassord")
or die ("Could not connect");
mysql_select_db ("YourMySQLDatabaseName")
or die ("Database not found.");
$sql = "INSERT INTO YourTableName (UsernameField,PasswordField,EmailField) VALUES ('$username','$password','$emailaddr')";
mysql_query ($sql)
or die (mysql_error());
}
This example assumes you have a submit button like ...
<input type="submit" name="adminsubmit" value="Submit" />
... and text form elements called username, password and emailaddr. Note: I have done virtually no validation on the data in this example.
I recommend you read the mySQL chapter of the PHP manual - you will learn a lot from it.
Bookmarks