-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertOrdserRezvition2.php
136 lines (129 loc) · 4.88 KB
/
insertOrdserRezvition2.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE HTML>
<html dir=RTL>
<head>
<meta charset="UTF-8">
<title>מערכת לניהול אירועים</title>
<link rel="stylesheet" type="text/css" href="include/cssstyle.css">
<script language="JavaScript" src="include/javascript.js"></script>
</head>
<body onLoad=mark()>
<script>document.write(header)</script>
<div id="wrapper">
<main>
<h2>יצירת אירוע</h2>
<section>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "reservvationmanager";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql="INSERT INTO `reservation` (`Reservation_Code`,`Reservation_Date`,`Size_of_the_event`,`Invoice_code`,`Menu_code`)
VALUES
(('".$_POST['Reservation_Code']."'),
('".$_POST['Reservation_Date']."'),
('".$_POST['Size_of_the_event']."'),
('".$_POST['Invoice_code']."'),
('".$_POST['Menu_code']."'))";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully return to table";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
<?php
// define variables and set to empty values
$Reservation_CodeErr = $Event_CodeErr = $hall_codeErr = $type_event_codeErr ="";
$Reservation_Code= $Event_Code = $hall_code =$type_event_code = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["Reservation_Code"])) {
$Reservation_CodeErr = "Reservation_Code is required";
} else {
$Reservation_Code = test_input($_POST["Reservation_Code"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$Reservation_Code)) {
$Reservation_CodeErr = "Only letters and white space allowed";
}
}
if (empty($_POST["Event_Code"])) {
$Event_CodeErr = "Event_Code is required";
} else $Event_Code = test_input($_POST["Event_Code"]);{
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$Event_Code)) {
$Event_CodeErr = "Only letters and white space allowed";
}
}
if (empty($_POST["hall_code"])) {
$hall_codeErr = "hall_code is required";
} else {
$hall_code = test_input($_POST["hall_code"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$hall_code)) {
$hall_codeErr = "Only letters and white space allowed";
}
}
if (empty($_POST["type_event_code"])) {
$type_event_codeErr = "type_event_code is required";
} else {
$type_event_code = test_input($_POST["type_event_code"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$type_event_code)) {
$type_event_codeErr = "Only letters and white space allowed";
}
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<p><span class="error">* required field.</span></p>
<p>Hall code:
<br>
Name hall : oppo - Hall code: 12 -People_capacity : 800
<br>
Name hall : root - Hall code:22 -People_capacity: 900
<br>
Name hall : porto - Hall code:32 -People_capacity: 3000
<br>
Name hall : benado - Hall code:42 -People_capacity: 2000
<br>
Name hall : toro - Hall code: 52 -People_capacity: 3000</p>
<p>type_event_code:
<br>
type_event_code: 400 - type_event: bar -mizva/ bat-mizva
<br>
type_event_code: 401 - type_event: brit/brita
<br>
type_event_code: 402 - type_event: Wedding
<br>
type_event_code: 403 - type_event: Birthday
<br>
type_event_code: 404 - type_event: Dance bar </p>
<form style="color:blue;font-family : arial;" method="post" action="insertOrdserRezvition3.php"<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>>
Reservation_Code: <input type="text" name="Reservation_Code" value="<?php echo $Reservation_Code;?>">
<span class="error">* <?php echo $Reservation_CodeErr;?></span>
<br><br>
Event_Code :<input type="text" name="Event_Code">
<br><br>
hall_code :<input type="text" name="hall_code">
<br><br>
type_event_code :<input type="text" name="type_event_code">
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</section>
</main>
<script>document.write(sideNav)</script>
<script>document.write(footer)</script>
</div>
</body>
</html>