bzr branch
http://gegoxaren.bato24.eu/bzr/booka/newlayout
|
1
by Gustav Hartvigsson
initial code... |
1 |
<?php
|
2 |
session_start(); |
|
3 |
include "./inc/dbConnect.php"; |
|
4 |
||
5 |
if($_SESSION[Login] != true){ |
|
6 |
header("Location: ./index.php"); |
|
7 |
}
|
|
8 |
||
9 |
include "./inc/head.php"; |
|
10 |
?>
|
|
11 |
||
12 |
<div id='dbedit' > |
|
13 |
<form id="dbEdit" method="post" action="./dbEditor.php" > |
|
14 |
<p>Start date<input type="text" name="startDate" /> End date <input type="text" name="endDate" /> <br /> |
|
15 |
Name <input type="text" name="name" /> phone number <input type="text" name="Phone" /> e-mail adress <input type="text" name="adress" /> <br /> |
|
16 |
<input type="submit" value="add to DB" /></p> |
|
17 |
</form>
|
|
18 |
</div>
|
|
19 |
||
20 |
<?php
|
|
21 |
if($_POST[startDate] != null && $_POST[endDate] != null && $_POST[name] != null){ |
|
22 |
||
23 |
$NName = "'".$_POST[name]."'"; |
|
24 |
||
25 |
$db->query("INSERT INTO booking(name,email,StartDate,EndDate) VALUES({$NName},{$_POST[adress]},{$_POST[startDate]},{$_POST[endDate]});"); |
|
26 |
||
27 |
echo "Values has been addet to DB.<br /> \n"; |
|
28 |
||
29 |
} else { |
|
30 |
||
31 |
echo "You need to enter: Start Date, End Date and Name! <br /> \n"; |
|
32 |
||
33 |
}
|
|
34 |
||
35 |
$result=$db->query("SELECT * FROM booking"); |
|
36 |
||
37 |
echo "current database structure:<br /> \n"; |
|
38 |
while($result->valid()){ |
|
39 |
||
40 |
$row = $result->current(); |
|
41 |
||
42 |
echo "<div id=#DB>" . $row . "</div>"; |
|
43 |
||
44 |
$result->next(); |
|
45 |
}
|
|
46 |
||
47 |
||
48 |
include "./inc/foot.php"; |
|
49 |
?>
|