-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact-us.php
99 lines (81 loc) · 4.3 KB
/
contact-us.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
<?php include './components/header.php'; ?>
<div class="ui container">
<!-- Top Navigation Bar -->
<?php include './components/top-menu.php'; ?>
<!-- BODY Content -->
<div class="ui grid">
<!-- Left menu -->
<?php include './components/side-menu.php'; ?>
<!-- right content -->
<div class="twelve wide column">
<h1>Contact Us</h1>
<p><strong>Address:</strong><br> FICTIONAL ORPHAN - Yuvodhaya 85, <br> 'D' Street, 7th Cross, Gandhinagar, <br> Bangalore 560009 Karnataka, India </p>
<p><strong>Email:</strong> [email protected]</p>
<p><strong>Tel:</strong> +91xxxxxxxx, +91xxxxxxxx</p>
<span class="p-20"></span>
<!-- Button to reveal the child registration form -->
<button id="showFormButton" class="ui primary button">Request Child Registration</button>
<!-- Child Registration Form (hidden by default) -->
<div id="childRegistrationForm" style="display: none;">
<h1>Child Registration Form</h1>
<?php
// Database connection
include 'db-connection.php'; // Make sure to include your database connection script
if(isset($_POST['submit_child'])) {
$child_name = $_POST['child_name'];
$child_dob = $_POST['child_dob'];
$child_yoe = $_POST['child_yoe'];
$child_class = $_POST['child_class'];
$child_story_behind = $_POST['child_story_behind'];
$child_pic = $_FILES['child_pic']['name'];
// Upload child picture
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["child_pic"]["name"]);
move_uploaded_file($_FILES["child_pic"]["tmp_name"], $target_file);
$sql = "INSERT INTO child_registration_requests (cname, cdob, cyoe, cclass, cstory, cphoto) VALUES ('$child_name', '$child_dob', '$child_yoe', '$child_class', '$child_story_behind', '$child_pic')";
if ($conn->query($sql) === TRUE) {
echo "<script>alert('Registration request submitted successfully');</script>";
} else {
echo "<script>alert('Error in submission');</script>";
}
$conn->close();
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="ui form" enctype="multipart/form-data">
<div class="seven wide field">
<label>Child Name</label>
<input type="text" name="child_name" placeholder="Child's Name" required>
</div>
<div class="seven wide field">
<label>Date of Birth</label>
<input type="date" name="child_dob" required>
</div>
<div class="seven wide field">
<label>Year of Enroll</label>
<input type="number" min="1900" max="2200" name="child_yoe" required>
</div>
<div class="seven wide field">
<label>Class / Grade</label>
<input type="number" min="1" max="12" name="child_class" required>
</div>
<div class="field">
<label>Story Behind</label>
<textarea name="child_story_behind" rows="2" required></textarea>
</div>
<div class="field">
<label>Upload Child Image</label>
<input type="file" name="child_pic" accept="image/*">
</div>
<button name="submit_child" type="submit" class="ui primary button">Submit</button>
<button type="reset" class="ui button">Reset</button>
</form>
</div>
</div>
</div>
</div>
<?php include './components/footer.php'; ?>
<script>
document.getElementById('showFormButton').addEventListener('click', function() {
document.getElementById('childRegistrationForm').style.display = 'block';
});
</script>