-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
64 lines (56 loc) · 2.39 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
$insert=false;
if(isset($_POST['name'])){
$server = "localhost";
$username = "root";
$password = "";
$con = mysqli_connect($server, $username, $password);
if(!$con){
die("connection to this database failed due to" . mysqli_connect_error());
}
$name = $_POST['name'];
$age = $_POST['age'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$sql = "INSERT INTO `trip`.`students` (`name`, `age`, `email`, `phone`, `address`, `date_time`) VALUES ('$name', '$age', '$email', '$phone', '$address', current_timestamp());";
if($con->query($sql)==true){
// echo "Successfully inserted";
$insert=true;
header("Location:/php_in_one_video/index.php");
exit;
}
else{
echo "ERROR: $sql <br> $con->error";
}
$con->close();
}
// exit;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css">
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
<title>Travel Form</title>
</head>
<body>
<img id="image" src="./ggsipu.jpg" alt="GGSIPU">
<div class="container">
<h1>Welcome to GGSIPU Travel form to LONDON GUYSS</h1>
<p>Enter your details and submit this form to confirm your participation in trip </p>
<form action="/php_in_one_video/index.php" method="post">
<input type="text" name="name" id="name" placeholder="Enter your Name" required>
<input type="text" name="age" id="age" placeholder="Enter your Age" required>
<input type="email" name="email" id="email" placeholder="Enter your email, name@example.com" required>
<input type="tel" name="phone" id="phone" placeholder="Enter your Phone number, +91-XXXXXXXXXX" required>
<textarea name="address" id="address" cols="30" rows="7" placeholder="Enter your Address" required></textarea>
<button type="submit" class="btn" onclick="return message();">Submit</button>
</form>
</div>
</body>
<script src="./script.js"></script>
</html>