-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrip.php
78 lines (63 loc) · 2.47 KB
/
trip.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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());
}
// echo "Success connecting to the database";
$Name = $_POST[ 'name' ];
$Gender = $_POST[ 'gender' ];
$Age = $_POST[ 'age' ];
$Email = $_POST[ 'email' ];
$Phone = $_POST[ 'phone' ];
$Desc = $_POST[ 'desc' ];
$sql = "INSERT INTO `us_trip`.`trip` (`Name`, `Age`, `Gender`, `Email`, `Phone`, `Other`, `dt`) VALUES ('
$Name', '$Age', '$Gender', '$Email', '$Phone', '$Desc', current_timestamp());";
// echo $sql;
if($con->query($sql) == true){
// echo "Successfully inserted";
$insert = true;
}
else{
echo "ERROR: $sql <br> $con->error";
}
$con->close();
}
?>
<!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">
<title>Welcome to travel form</title>
<link rel="stylesheet" href="trip.css">
<link href="https://fonts.googleapis.com/css2?family=Amita&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Amita&family=Fondamento&display=swap" rel="stylesheet">
</head>
<body>
<img class="bg" src="bg.jpeg" alt="IIT Kharagpur">
<div class="container">
<h3>Welcome to IIT Kharagpur US trip form</h3>
<p>Enter your details and submit this form to confirm your participation in this trip</p>
<?php
if($insert == true){
echo "<p class='bago'>Thanks for submitting the form ,we are happy to se you joining the trip</p>";
}
?>
<form action="" method="post">
<input type="text" name="name" id="Name" placeholder="Enter your name">
<input type="text" name="age" id="Age" placeholder="Enter your age">
<input type="text" name="gender" id="gender" placeholder="Enter your gender">
<input type="email" name="email" id="Email" placeholder="Enter your email">
<input type="number" name="phone" id="Phone" placeholder="Enter your phone number">
<textarea name="desc" id="Desc" cols="10" rows="10" placeholder="Enter any other information"></textarea>
<input type="submit" value="Submit" class="btn">
</form>
</div>
</body>
</html>