-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidatecaterer.php
104 lines (85 loc) · 3.23 KB
/
validatecaterer.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
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>ZUMBA AIR</title>
<link rel="stylesheet" type="text/css" href="zumbacss.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR|Pacifico" rel="stylesheet">
</head>
<?php
echo '
<div id="banner">
<div class="logoimg">
<img src="zumbaairlogo.png" height="140px" width="140px";>
</div>
<div class="logobrand">
<p>THE PRIDE OF AIR TRAVEL</p>
</div>
</div>
<div class="transition"><a href="logout.php"><input type="button" value="Logout"></a></div>';
echo'<div id = "notes">' ;
echo "<ul style='list-style-type:none;'>";
echo'<li><form action="newmeal.php" method="GET">
<button class="button" type="submit" name="newmeal">New Request</button>
</form> </li> ' ;
echo'<li><form action="viewmeal.php" method="GET">
<button class="button" type="submit" name="Viewupdatemeal">View/Update Request</button>
</form> </li>' ;
echo'<li><form action="addcaterer.php" method="GET">
<button class="button" type="submit" name="addcaterer">Add new Caterer</button>
</form> </li>' ;
echo'<li><form action="searchcaterer.php" method="GET">
<button class="button" type="submit" name="updatecatererinfo">View / Update Caterer </button>
</form> </li>' ;
echo "</ul>";
echo "<br><br><br><br><br><br><br>";
echo "</div>";
echo'<div id = "welcomepage">' ;
echo "<p class='welcomenote'>Welcome ".$_SESSION['username']."</p>";
$comname = ($_REQUEST['comname']);
$comfname = ($_REQUEST['comfname']);
$comlname = ($_REQUEST['comlname']);
$comphone = ($_REQUEST['comphone']);
$comemail = ($_REQUEST['comemail']);
$comstrt = ($_REQUEST['comstrt']);
$comsuite = ($_REQUEST['comsuite']);
$comcity = ($_REQUEST['comcity']);
$comzipcode = ($_REQUEST['comzipcode']);
$comstate = ($_REQUEST['comstate']);
$comaccount = ($_REQUEST['comaccount']);
if(isset($comaccount))
{
if(empty($comname) || empty($comfname) || empty($comlname) || empty($comphone) || empty($comemail) || empty($comstrt) || empty($comcity) || empty($comzipcode) || empty($comstate))
{
echo ("<center><span style='color:red' font-size='15px'> **Fields can not be left blank!!** </span>");
}
elseif ((!is_numeric($comphone)) || (!is_numeric($comzipcode)))
{
echo ("<center><span style='color:red' font-size='15px'>**You have entered incorrect form of data!!**</span>");
}
else
{
include "../../../connection_string.php"; //contains MySQL login information
mysql_select_db("ZumbaAir", $con);
$valcomname = mysql_query ("SELECT COUNT(*) as total FROM Zumbacaterers WHERE comname = '$comname'");
$viewcomname = mysql_fetch_assoc($valcomname);
if (($viewcomname['total']) > 0)
{die ("<center><span style='color:red' font-size='15px'>**This Company is already listed as a supplier!!**</span>");}
else
{
$insertquery = mysql_query("INSERT INTO Zumbacaterers VALUES ('$comname', '$comfname', '$comlname', '$comphone', '$comemail', '$comstrt', '$comsuite', '$comcity','$comstate','$comzipcode')");
echo "<center>Information entered successfully! <br> <br>";
echo "<br> <br>";
echo "<br> <br>";
}
}
}
echo "</div>";
?>
<div id="footer">
</br>
<b>© Zumba Air| [email protected] | </b></div>
</body>
</html>