-
Notifications
You must be signed in to change notification settings - Fork 1
/
adddate.php
61 lines (49 loc) · 1.7 KB
/
adddate.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
<?php
include_once "connection/conn.php";
?>
<?php include_once "file/header.php"; ?>
<section class="contentsection clear">
<?php include_once "file/sidebar.php"; ?>
<article class="maincontent clear">
<div class="content">
<h2>Add Date</h2>
<?php
if ($_SERVER["REQUEST_METHOD"]=="POST") {
$dname=$_POST["dname"];
if (empty($dname)) {
echo "Date Is Empty";
}else{
$sql="SELECT * FROM tbl_date where date_name='$dname'";
$query=mysqli_query($connection,$sql);
$row=mysqli_num_rows($query);
if ($row<1) {
$sql="INSERT INTO tbl_date (date_name) VALUES('$dname');";
$query=mysqli_query($connection,$sql);
if ($query) {
echo "Date Is Inserted";
}
}else{
echo "Not Inserted Yet";
}
}
}
?>
<form action="" method="post">
<table>
<tr>
<td>Date Name</td>
<td><input type="date" name="dname" placeholder="Date"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Add"/></td>
</tr>
</table>
</form>
</div>
</article>
</section>
<?php include_once "file/footer.php"; ?>
</div>
</body>
</html>