-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.php
28 lines (24 loc) · 927 Bytes
/
index.php
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
<?php
$insert = false;
if(isset($_POST['name'])){
// Set connection variables
$server = getenv('DB_HOST');
$username = getenv('DB_USERNAME');
$password = getenv('DB_PASSWORD');
// Create a database connection
$con = mysqli_connect($server, $username, $password);
// Check for connection success
if(!$con){
die("connection to this database failed due to" . mysqli_connect_error());
}
// echo "Success connecting to the db";
// Collect post variables
$name = $_POST['name'];
$gender = $_POST['gender'];
$age = $_POST['age'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$desc = $_POST['desc'];
$sql = "INSERT INTO `mussorie trip`.`mussorie trip` (`name`, `age`, `gender`, `email`, `phone`, `other`, `dt`) VALUES ('$name', '$age', '$gender', '$email', '$phone', '$desc', current_timestamp());";
// echo $sql;
// Execute the query