1. Create a config.php file.

2. Specify your mySQL DB details – DB hostname, DB username, DB password and the DB name.

3. Run this php file and make sure you are able to connect to the Database.

<?php

include_once “config.php”;

$firstname=””;
$email=””;
$sqlq=””;

$firstname=$_POST[‘firstname’];
$email=$_POST[’email’];

$firstname=stripslashes($firstname);
$email=stripslashes($email);

$firstname=strip_tags($firstname);
$email=strip_tags($email);

$sqlq=mysql_query(“INSERT INTO mydetails (name,email) VALUES(‘$firstname’,’$email’)”)
or die (mysql_error());

?>

HTML Form..

<html>

<body>

<table>

<form action=”test.php” method=”post”>

<tr>

<td>
First Name:
</td>

<td>
<input name=”firstname” id=”firstname”/>
</td>
</tr>

<tr>

<td>
Email:
</td>

<td>
<input name=”email” id=”email”/>
</td>
</tr>

<tr>

<td>

<input type=”submit” name=”submit” value=”Submit Form”/>
</td>
</tr>

</form>

</table>

<? echo “Your details have been saved”; ?>

</body>

</html>