-
Notifications
You must be signed in to change notification settings - Fork 0
/
createListing.php
134 lines (124 loc) · 4.34 KB
/
createListing.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
<?php
session_start();
$destination = "";
$dateListed = "";
$rate = "";
$weight = "";
$err = false;
$origin = "";
$miles = "";
$clientID="200";
if (isset($_POST['submit'])) {
if(isset($_POST['destination'])) $destination = $_POST['destination'];
if(isset($_POST['dateListed'])) $dateListed = $_POST['dateListed'];
if(isset($_POST['rate'])) $rate = $_POST['rate'];
if(isset($_POST['weight'])) $weight = $_POST['weight'];
if(isset($_POST['origin'])) $origin = $_POST['origin'];
if(isset($_POST['miles'])) $miles = $_POST['miles'];
if(isset($_POST['clientName'])) $clientName = $_SESSION['clientName'];
if(isset($_SESSION['clientID'])) $clientID = $_SESSION['clientID'];
if (!empty($destination) && !empty($dateListed) && !empty($weight)
&& !empty($origin))
{
$_SESSION['origin'] = $origin;
$_SESSION['destination'] = $destination;
$_SESSION['dateListed'] = $dateListed;
$_SESSION['rate'] = $rate;
$_SESSION['weight'] = $weight;
$_SESSION['clientID'] = $clientID;
$_SESSION['miles']= $miles;
$_SESSION['clientName']=$clientName;
header("Location: listingCreationConfirm.php");
}
else
{
$err = true;
}
}
?>
<!doctype html>
<html>
<head>
<title>Reynholm Industries</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<img src="reynholm.jpg" height=5% width=5% />
<ul class="nav nav-tabs">
<li><a href="clientLanding.php">Home</a></li>
<li><a href="clientListingsPage.php">Your Listings</a></li>
<li><a href="clientCurrentLoads.php">Loads in Transit</a></li>
<li><a href="clientPastLoads.php">Past Loads</a></li>
<li class="active"><a href="createListing.php">Create Listing</a></li>
<li><a href="clientAccountManagement.php">Manage Account</a></li>
</ul>
<div style='margin-left: auto; display: block; margin-right: auto;width: 300px;'>
ENTER NEW LISTING INFORMATION
</br>
</br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<label>origin:
<input type="text" name="origin" value="<?php echo $origin; ?>" />
<?php
if ($err && empty($origin)) {
echo "<label class='errlabel'>Please enter a valid origin.</label>";
}
?>
</label>
<br />
<label>destination:
<input type="text" name="destination" value="<?php echo $destination; ?>" />
<?php
if ($err && empty($destination)) {
echo "<label class='errlabel'>Please enter a valid destination.</label>";
}
?>
</label>
<br />
<label>dateListed:
<input type="date" name="dateListed" value="<?php echo date('Y-m-d'); ?>"min="<?php echo date('Y-m-d'); ?>" max="2018-12-31"/>
<?php
if ($err && empty($dateListed)) {
echo "<label class='errlabel'>Please enter a dateListed.</label>";
}
?>
</label>
<br />
<label>rate:
<input type="number" name="rate" value="<?php echo $rate; ?>" />
<?php
if ($err && empty($rate)) {
echo "<label class='errlabel'>Please enter a proper rate.</label>";
}
?>
</label>
<br />
<label>miles:
<input type="number" name="miles" value="<?php echo $miles; ?>" />
<?php
if ($err && empty($miles)) {
echo "<label class='errlabel'>Please enter a proper number of miles.</label>";
}
?>
</label>
<br />
<label>weight:
<input type="number" name="weight" value="<?php echo $weight; ?>" />
<?php
if ($err && empty($weight)) {
echo "<label class='errlabel'>Please enter a Location.</label>";
}
?>
</label>
<br />
<input type="hidden" name="clientName" value=<?php $clientName ?>/>
<input type="submit" name="submit" value="Submit" />
</form>
</div>
<p style='margin-left: auto; display: block; margin-right: auto;'>
<a style="background-color:white;" href="logout.php">Click here to log out</a>
</p>
</body>