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
|
<?php
session_start();
include "./inc/dbConnect.php";
if($_SESSION[Login] != true){
header("Location: ./index.php");
}
include "./inc/head.php";
?>
<div id='dbedit' >
<form id="dbEdit" method="post" action="./dbEditor.php" >
<p>Start date<input type="text" name="startDate" /> End date <input type="text" name="endDate" /> <br />
Name <input type="text" name="name" /> phone number <input type="text" name="Phone" /> e-mail adress <input type="text" name="adress" /> <br />
<input type="submit" value="add to DB" /></p>
</form>
</div>
<?php
if($_POST[startDate] != null && $_POST[endDate] != null && $_POST[name] != null){
$NName = "'".$_POST[name]."'";
$db->query("INSERT INTO booking(name,email,StartDate,EndDate) VALUES({$NName},{$_POST[adress]},{$_POST[startDate]},{$_POST[endDate]});");
echo "Values has been addet to DB.<br /> \n";
} else {
echo "You need to enter: Start Date, End Date and Name! <br /> \n";
}
$result=$db->query("SELECT * FROM booking");
echo "current database structure:<br /> \n";
while($result->valid()){
$row = $result->current();
echo "<div id=#DB>" . $row . "</div>";
$result->next();
}
include "./inc/foot.php";
?>
|