-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
131 lines (125 loc) · 3.74 KB
/
contact.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
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
<?php
include("./php/database.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact - Chandigarh College of Engineering and Technology</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: 0 auto;
padding: 20px;
}
h1 {
text-align: center;
}
.contact-info {
margin-top: 20px;
}
.contact-info p {
margin-bottom: 10px;
}
.contact-form {
margin-top: 20px;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
width: 100%;
padding: 10px;
margin: 5px 0;
box-sizing: border-box;
}
.contact-form textarea {
height: 150px;
}
.contact-form input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
}
.contact-form input[type="submit"]:hover {
background-color: #45a049;
}
nav {
background-color: #333;
padding: 10px 0;
text-align: center;
}
nav a {
color: #fff;
margin: 0 10px;
text-decoration: none;
}
nav a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<nav>
<a href="index.php">Home</a>
<a href="notices.php">Notices</a>
<a href="about.php">About</a>
<a href="contact.php">Contact</a>
<?php
if (isset($_SESSION['login']) && $_SESSION['login'] === true) {
echo '<a href="logout.php">Logout</a>';
} else {
echo '<a href="login.php">Login</a>';
}
?>
<a href="signup.php">Sign up</a>
</nav>
<div class="container">
<h1>Contact Chandigarh College of Engineering and Technology</h1>
<div class="contact-info">
<p><strong>Address:</strong> Chandigarh College of Engineering and Technology, Sector 26, Chandigarh, India</p>
<p><strong>Phone:</strong> +91 XXXXXXXXXX</p>
<p><strong>Email:</strong> [email protected]</p>
</div>
<div class="contact-form">
<h2>Send us a message</h2>
<form id="contactForm">
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Your Email" required>
<textarea name="message" placeholder="Your Message" required></textarea>
<input type="submit" name="submit" value="Send Message">
</form>
</div>
</div>
</body>
<script>
document.addEventListener("DOMContentLoaded", function () {
var contactForm = document.getElementById('contactForm');
contactForm.addEventListener('submit', function (event) {
event.preventDefault();
var formData = new FormData(contactForm);
var xhr = new XMLHttpRequest();
xhr.open('POST', 'contact_process.php', true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
alert('Message sent successfully!');
contactForm.reset();
} else {
alert('Error sending message. Please try again.');
}
}
};
xhr.send(formData);
});
});
</script>
</html>