-
Notifications
You must be signed in to change notification settings - Fork 0
/
newappoint.php
63 lines (51 loc) · 1.77 KB
/
newappoint.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
<?php
include 'sqlconnect.php';
include 'calendar.php';
?>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Create appointment</title>
</head>
<body>
<?php
if(isset($_POST['newapp']))
{
process_appointment();
unset($_POST['newapp']);
}
?>
<form class="" action=<?php echo '"'.$_SERVER['PHP_SELF'].'"' ?> method="post">
<input type="text" name="title" value="" placeholder="Title"/>
<input type="textarea" name="description" value="" placeholder="Descri"/>
<input type="time" name="start" value="" placeholder="start time">
<input type="time" name="end" value="" placeholder="end time">
<input type="submit" name="submit" value="Create Appointment">
<input type="hidden" name="newapp" value="newappset">
<?php
if(isset($_POST['processapp'])){
echo '<input type = "hidden" name = "date" value = "'.$_POST['datenew'].'">';
echo '<input type = "hidden" name = "month" value = "'.$_POST['monthnew'].'">';
echo '<input type = "hidden" name = "year" value = "'.$_POST['yearnew'].'">';
}
?>
</form>
<?php
function process_appointment(){
$conn = mysqli_connect("localhost","username", "password", "deltadb");
$title = $_POST['title'];
$descri = $_POST['description'];
$stime = $_POST['start'];
$etime = $_POST['end'];
$date = $_POST['date'];
$month = $_POST['month'];
$year = $_POST['year'];
if($stime=='') echo 'Start-time can\'t be empty';
if($etime=='') echo 'ENd time can\'t be empty';
else{$query = "INSERT INTO deltadb.appointtable VALUES ('".$date."', '".$month."', '".$year."', '".$title."', '".$descri."', '".$stime."', '".$etime."')";
mysqli_query($conn, $query);
}
}
?>
</body>
</html>