/booka/newlayout

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/booka/newlayout
1 by Gustav Hartvigsson
initial code...
1
<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
2
session_start();
3
/*
4
	dbEditor.php
5
*/
35 by Gustav Hartvigsson
trying out new layout, initial work
6
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
7
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
8
$errorMsg = null; //ERRORMSG!
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
9
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
10
//manipulation of DB
11
$newname = $_POST[name];
12
$newphone = $_POST[phone];
13
$newmail = $_POST[email];
14
$newadress = $_POST[adress];
15
$newStartDate = $_POST[StartDate];
16
$newEndDate = $_POST[EndDate];
17
29 by Gustav Hartvigsson
iBah
18
$valid = true; //this will be true untill it is changed.
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
19
24 by Gustav Hartvigsson
changed some stuff to use the CSS class 'warning'.
20
include "./inc/formif.php";//ifs and buts for checking if inputed data is there.
21
include "./inc/regex.php";//RegEX chexing of dates.
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
22
//TODO: figure out why the errorMsg is only set by regex.php ...
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
23
24
if( $valid ){
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
25
	
26
	$db->queryexec("BEGIN;
27
		INSERT INTO bookings(name, StartDate, EndDate, phone, mail, adress) VALUES('{$newname}', '{$newStartDate}', '{$newEndDate}', '{$newphone}', '{$newmail}', '{$newadress}');
28
	COMMIT") or die("could not insert in to table");
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
29
	sleep(.5);
30
	header('Location: ./dbEditor.php');
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
31
}
32
//end of DB manipulation.
1 by Gustav Hartvigsson
initial code...
33
?>
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
34
	
35
	<div class="menu2">
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
36
		 <?php
37
		 if($errorMsg!=null){
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
38
		 	echo "	<p class='warning'>".$errorMsg."</p> <!-- this paragraph is created by the php script -->";
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
39
		 }
40
		 ?>
13 by Gustav Hartvigsson
Fixed stiff with the url's cousing the admin panel to not show.
41
		 
35 by Gustav Hartvigsson
trying out new layout, initial work
42
		 <form action="BooKa.php" method="post">
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
43
		 	<div class="lefta">
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
44
		 		<label for="name" <?php echo $nameunset ?>>Name</label> <input type="text" name="name" <?php echo $nameunset ?> /> <br />
45
		 		<label for="phone" <?php echo $phoneunset ?>>Phone number</label> <input type="text" name="phone" id="phone" <?php echo $phoneunset ?> /><br />
46
		 		<label for="email" <?php echo $emailunset ?>>e-mail address</label> <input type="text" name="email" id="email" <?php echo $emailunset ?> /><br />
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
47
		 	</div>
48
		 	<div class="righta">
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
49
		 		<label for="adress" <?php echo $adressunset ?> >adress</label> <input type="text" name="adress" id="adress" <?php echo $adressunset ?> /> <br />
50
		 		<label for="StartDate" <?php echo $StartDateunset ?>>Start Date </label> <input type="text" name="StartDate" id="StartDate" <?php echo $StartDateunset ?> /><br />
51
		 		<label for="EndDate" <?php echo $EndDateunset ?> >End Date</label> <input type="text" name="EndDate" id="EndDate" <?php echo $EndDateunset ?> /> <br />
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
52
		 		</div>
53
		 	<input type="hidden" name="fromadd" value="true" />
54
		 	<p><input type="submit" value="add" name="add" class="add" /></p>
55
		</form>
56
		 
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
57
		 
14 by Gustav Hartvigsson
Fixed error in dbEditor where it said that the remove button did not work.
58
		<h2> current DB structure. </h2>
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
59
		 
16 by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix.
60
		<table> <!-- tabell -->
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
61
			<tr> <!-- row one -->
62
				<td> id </td>
63
				<td> Name </td>
64
				<td> Start Date </td>
65
				<td> End Date </td>
66
				<td> Phone Number </td>
67
				<td> E-mail </td>
68
				<td> Adress </td>
69
				<td> remove </td>
70
			</tr> <!-- end of row one -->
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
71
			<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
72
			
73
			$result = $db->query("SELECT * FROM bookings") or die("could not do query!");
74
			foreach($result as $row){
75
			?>
76
			<tr> <!-- Row two and up -->
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
77
				<td> <?php echo $row[id]?> </td>
78
				<td> <?php echo $row[name]?> </td>
79
				<td> <?php echo $row[StartDate]?> </td>
80
				<td> <?php echo $row[EndDate]?> </td>
81
				<td> <?php echo $row[phone]?> </td>
82
				<td> <?php echo $row[mail]?> </td>
83
				<td> <?php echo $row[adress]?> </td>
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
84
				<td>
85
					<form action="removeFromDB.php" method="post">
86
						<p>
87
							<input type="submit" value="remove" />
88
							<input type="hidden" value="<? echo $row[id]?>" name="id"/>
89
						</p>
90
					</form>
91
				</td>
92
			</tr> <!-- end of row two and up -->
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
93
			<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
94
			}
95
			?>
96
		</table>
97
		 
98
	</div>
99
100