I have an html form when i submit it it goes to a php page. i want to change the action so the php execution happens on the same page.
<form method ="POST" action = "user.php">
<table align="right" cellpadding="10" cellspacing="0">
<tr>
<td>EMail: </td>
<td><input type="text" name="email" /></td>
<tr>
<td>First Name: </td>
<td><input type="text" name="fname" /></td>
<tr>
<td>Last Name: </td>
<td><input type="text" name="lname" /></td>
<tr>
<td>Password:</td>
<td><input type="password" name="password" /></td>
<tr>
<td><input type ="submit"></td>
</tr>
</table>
</form>
<?php
//conection
include('sqlconn.php');
$mysql = new sqlConnection;
//retrive data from POST form
$email=$_POST['email'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$password=$_POST['password'];
//insert data into DB
$query = "INSERT INTO `client_Info`.`users` (`email` ,`fname` ,`lname` ,`password`)
VALUES (NULL , '$email', '$fname', '$lname', '$password')";
mysql_query($query) or die('Error, insert query failed');
$last_Id = mysql_insert_id();
$mysql->close();
//redirect back to login page.
header( 'Location: http://localhost/testsite' ) ;
?>