Hi Everyone,
This is the HTML page I created for input:
HTML Code:
<html>
<body>
 <form action = "insert_persons.php" method="GET">
	startdate: <input type ="text" name="startDate">
	enddate: <input type ="text" name="endDate">
	<input type="submit">
</form>
</body>
</html>
This is insert_persons.php file that contains the code to insert data from HTML page into MySql table
PHP Code:
<?php
 
echo $_GET['startDate'];
 echo 
$_GET['endDate'];
 
  
$con=mysqli_connect("localhost","root","pass","db");
// Check connection
if (mysqli_connect_errno())
  {
  echo 
"Failed to connect to MySQL: " mysqli_connect_error();
  }

 
$sql="INSERT INTO persons (startDate, endDate, intervalTime)
VALUES
(
 '
$_GET[startDate]',
 '
$_GET[endDate]',
 TIMEDIFF('
$_GET[endDate]','$_GET[startDate]')
 )"
;

if (!
mysqli_query($con,$sql))
  {
  die(
'Error: ' mysqli_error($con));
  }
echo 
"1 record added";
?>
Here is the data I assigned in the HTML page:
startdate- 2013-07-02 11:00:00
enddate- 2013-07-02 14:45:00
When I press the "Submit" button something strange happens: On the screen I get the code of php file shown above.
The code doesn't update the MySql table. It just appears on the screen.
Any idea what goes wrong?
Thanks