insert.php 593 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<html>
<?php
$servername = "localhost";
$username = "root";
$password = "Localhost";
$dbname = "projectbus1";

$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    
    die("Connection failed: " . $conn->connect_error);
} 
if ((isset($_POST['submit'])))
{
        echo "HI";
	
	$destination = $_POST['destination'];
	$sql = "INSERT INTO destination (destination) VALUES('$destination')";
	if ($conn->query($sql) === TRUE) {
  header('Location: retrive.php');
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
}
	

?>