First you need a web server to work with php.Not like html , PHP is a server-side scripting language.So PHP code is executed on the server, and the plain HTML result is sent to the browser.
You can use apache & mysql (have to configure) ,XAMPP or WAMP.
In apache all files you wish to host, have be in htdocs folder .So your pages have save in the htdocs folder.
after saving files in htdocs, you have to start apache and mysql servers.After that you can access you pages as "http://localhost/xxxxx". xxxxx is the page name.
Finally following two pages have to save in htdocs folder in apache or in XAMPP or in WAMP.
Further you can modify the cod as you wish but this is the basic code for ur requirement.
I think this will help u to start...
==========================================================
This is a sample code runs in client side.That means form which is going to see the user.You enter data from this page.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<html>
<head><title>Text you want to see as title</title></head>
<body>
/*form begins here*/
/*Codes that saves ur data are in insert.php page.So action of the form should be that page.(insert.php)*/
<form action="insert.php" method="post">
/*You can use any label for text boxes and any layout.(ex. You can use tables or Div areas to allign ur fields).So list of text areas should mentioned at least with their "name" attribute.Instead of text boxes you can use check boxes or drop downs for user inputs. Important thing is at least they should have a unique name*/
Text Box 1<input type="text" name="field1" />
Text Box 2<input type="text" name="field2" />
Text Box 3<input type="text" name="field3" />
/*your data will post to insert.php using a button click.So we have to submit data to other page.Then button type should be as "submit".in "value" attribute you can give any name you want to see on the button*/
<input type="submit" value="save" />
</form>
/*form ends here*/
</body>
</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This is the insert.php page which is going to run in server side.This should save as insert.php(you can give any name which have given as the action of the form of previous page)
<?php
/*connect to the database.Parameters are host name , user name , password. If you run this in ur local machine host name is localhost.in this code root is the username and root123 is the password .There can be many databases in ur database collection.So you have to give the name of the database name which has the tables for your entering data."database_name" is the database name you are going to use.*/
$con = mysql_connect("localhost","root","root123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_name", $con);
/*Sql query will runs from here."Persons" is the table name in the "database_name" database. (field1, field2, field3) are the fields in the table which are holding ur data .. $_POST[field1]','$_POST[field1]','$_POST[field1] are the values that u send from the previous page*/
$sql="INSERT INTO Persons (field1, field2, field3)
VALUES
('$_POST[field1]','$_POST[field1]','$_POST[field1]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>