-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact.php
More file actions
157 lines (149 loc) · 5.42 KB
/
contact.php
File metadata and controls
157 lines (149 loc) · 5.42 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php session_start();
?>
<!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>Contact us | Alone</title>
<!-- Material Icon CDN -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Materialize CSS CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Your custom styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Used as an example only to position the footer at the end of the page.
You can delete these styles or move it to your custom css file -->
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
</head>
<body>
<header>
<nav class="black">
<div class="nav-wrapper">
<div class="container">
<a href="/index.php" class="brand-logo pink-text">Alone</a>
<a href="#" data-activates="mobile-menu" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="/index.php">Home</a></li>
<li><a href="/events.php">Events</a></li>
<?php if( isset($_SESSION['username']) && !empty($_SESSION['username']) )
{
?>
<li><a href="<?php if($_SESSION['id']=='1'){echo "admin/admin_dashboard.php";}
else echo "/dashboard.php"; ?>">Dashboard</a></li>
<li><a href="logout.php">Logout</a></li>
<?php }else{ ?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
<?php } ?>
<li><a href="/contact.php" class="active">Contact us</a></li>
</ul>
</div>
</div>
</nav>
</header>
<main>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name=$_POST['name'];
$email=$_POST['email'];
$phone_no=$_POST['phone'];
$description=$_POST['description'];
require_once("db-connection.php");
$sql = "INSERT INTO reach_us(name, email, phone_no, description)
VALUES
('$name','$email',$phone_no,'$description')";
if (mysqli_query($conn,$sql)) {
?><h5 class="center green-text">Successfully Contacted</h5>
<?php
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
<section class="cus-pad">
<div class="container">
<h4 class="center orange-text">Reach us</h4>
<div class="row">
<div class="col s4">
<div class="card grey lighten-3">
<div class="card-content black-text">
<span class="card-title"><h5 class="center">Phone</h5></span>
<p class="center">9265845310/0225136850</p>
</div>
</div>
</div>
<div class="col s4">
<div class="card grey lighten-3">
<div class="card-content black-text">
<span class="card-title"><h5 class="center">E-mail</h5></span>
<p class="center">something123@gmail.com</p>
</div>
</div>
</div>
<div class="col s4">
<div class="card grey lighten-3">
<div class="card-content black-text">
<span class="card-title"><h5 class="center">Address</h5></span>
<p class="center">Knsit Bangalore</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="grey lighten-4 cus-pad">
<div class="container">
<h4 class="purple-text">Write to us</h4>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="POST">
<div class="row">
<div class="input-field col s6">
<input type="text" name="name" class="validate" required>
<label for="name">Name</label>
</div>
<div class="input-field col s6">
<input type="email" name="email" class="validate">
<label for="email" data-error="wrong" data-success="right">Email</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input name="phone" type="number" class="validate" required>
<label for="phone">Phone</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<textarea name="description" class="materialize-textarea" required></textarea>
<label for="textarea1">Textarea</label>
</div>
</div>
<div class="row">
<button class="btn waves-effect waves-light purple" type="submit" name="action">Submit</button>
</div>
</form>
</div>
</section>
</main>
<?php require('footer.php'); ?>
<!-- jQuery CDN -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<!-- Materialize JS CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<script>
$("document").ready(function(){
$(".button-collapse").sideNav();
});
</script>
</body>
</html>