-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost_ad.php
More file actions
247 lines (210 loc) · 6.04 KB
/
Post_ad.php
File metadata and controls
247 lines (210 loc) · 6.04 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
session_start();
// include_once("loggingin.php");
if(!isset($_SESSION['login_user_name']))
{
header("location: Register.php");
// header('Location: http://localhost/Happy2Help/BidBot/Register.php');
}
include_once("template_header_logged_in.php");?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Post Ad</title>
<script src="js/jquery.min.js"></script>
<link rel='stylesheet' href="css/bootstrap.min.css"/>
<script src="js/bootstrap.min.js"></script>
<!--<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-theme.min.css">-->
<script>
function show( t)
{
var th=document.getElementById("showfile");
th.value=t.value.split("fakepath\\")[1];
}
function validateProductForm()
{
console.log('asd');
var title=document.getElementById("element-1").value;
var years=document.getElementById("element-2").value;
var category=document.getElementById("element-5").value;
var startingprice=document.getElementById("element-5").value;
var Details=document.getElementById("element-3").value;
if ((title==null || title=="") && (years==null || years=="") && (category==null || category=="")&& (Details==null || Details)&& (startingprice==null || startingprice=="") )
{
alert("All Field must be filled out");
return false;
}
if (title==null || title=="")
{
alert("Title must be filled out");
return false;
}
if (startingprice==null || startingprice=="")
{
alert("Starting price must be filled out");
return false;
}
if (years==null || years=="")
{
alert("Years Of Usage must be filled out");
return false;
}
if (category==null || category=="")
{
alert("category must be filled out");
return false;
}
if (Details==null || Details=="")
{
alert("Details must be filled out");
return false;
}
if(Details.length>100)
{
alert("Details can't be that large ");
return false;
}
if(years<0)
{
alert("Years Of Usage can't be that large ");
return false;
}
if(Details.length<5)
{
alert("Details can't be that small");
return false;
}
}
</script>
<style>
/*table layout - last column*/
table tr td:last-child {
white-space: nowrap;
width: 1px;
text-align:right;
}
/* layout.css Style */
.upload-drop-zone {
height: 200px;
border-width: 2px;
margin-bottom: 20px;
}
/* skin.css Style*/
.upload-drop-zone {
color: #ccc;
border-style: dashed;
border-color: #ccc;
line-height: 200px;
text-align: center
}
.upload-drop-zone.drop {
color: #222;
border-color: #222;
}
.image-preview-input {
position: relative;
overflow: hidden;
margin: 0px;
color: #333;
background-color: #fff;
border-color: #ccc;
}
.image-preview-input input[type=file] {
position: absolute;
top: 0;
right: 0;
margin: 0;
padding: 0;
font-size: 20px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.image-preview-input-title {
margin-left:2px;
}
</style>
</head>
<body>
<!--<script src="bootstrap.js"></script>
<script src="bootstrap.min.js"></script>-->
<div class="container">
<div class="col-lg-3">
</div>
<div class="col-lg-5">
<h1>Post your Free Ad</h1>
</div>
</div>
<div class="container">
<div class="col-lg-3">
</div>
<div class="col-lg-5">
<br>
<form class=" cm" method="post" action="addingproduct.php" enctype="multipart/form-data" onsubmit="return validateProductForm();">
<label for="element-1">Ad Title :</label>
<input type="text" class="form-control" name="title" id="element-1" placeholder="Enter Title for your Ad">
<br>
<label for="element-2"> Years of Usage :</label>
<input type='number' class="form-control" name="years" id="element-2" placeholder="Enter years used">
<br>
<div class="row">
<div class="col-md-12">
<label for="element-3" >Category:</label>
<select type="text" class="form-control multiselect multiselect-icon" id="element-5" name="category" role="multiselect" >
<option value="1">Electronics</option>
<option value="2">Household</option>
<option value="3">Vehicles</option>
<option value="4">Other</option>
</select>
</div>
</div>
<br>
<label for="element-4">Ad Details :</label>
<textarea type="text" class=" form-control-lgg" id="element-3" name=" details" placeholder="Enter Details of the product" style="margin: 0px -2px 0px 0px;height:116px;width:445px;"></textarea>
<br>
<br>
<div class="row">
<div class="col-md-12">
<label for="element-5">Upload Photos :</label>
<div class="panel panel-default">
<div class="panel-body">
<div class="input-group image-preview">
<input placeholder="" type="text" class="form-control image-preview-filename" id="showfile" disabled="disabled">
<!-- don't give a name === doesn't send on POST/GET -->
<span class="input-group-btn">
<!-- image-preview-clear button -->
<button type="button" class="btn btn-default image-preview-clear" style="display:none;"> <span class="glyphicon glyphicon-remove"></span> Clear </button>
<!-- image-preview-input -->
<div class="btn btn-default image-preview-input"> <span class="glyphicon glyphicon-folder-open"></span> <span class="image-preview-input-title">Browse</span>
<input type="file" accept="image/png, image/jpeg, image/gif" name="image" onchange="show(this);"/>
<!-- rename it -->
</div>
</span> </div>
<!-- /input-group image-preview [TO HERE]-->
<br />
<!-- Drop Zone -->
<br />
</div>
</div>
</div>
</div>
<br>
<label for="element-4">Starting Price :</label>
<input type="text" class="form-control" id="element-4" name="price" placeholder="Enter your Base Price">
<p> <br></p>
</div>
<div class="container">
<div class="row">
<div class="col-lg-5">
</div>
<div class="col-lg-5">
<button type="submit" class="btn btn-info">Submit</button>
</div>
</div>
</div>
</form>
</div>
</body>
</html>