-
Notifications
You must be signed in to change notification settings - Fork 2
/
contributor-profile.php
238 lines (199 loc) · 9.24 KB
/
contributor-profile.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
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
<?php
session_start();
if(!isset($_SESSION["uid"]))
{
header("location:index.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="java-script/jquery-1.8.2.min.js"></script>
<script src="java-script/bootstrap.js" type="text/javascript"></script>
<link rel="stylesheet" href="style/bootstrap.css">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script>
function showpreview(file, ref) {
if ($(file)[0].files[0].size > 2097152) {
return;
}
if (file.files && file.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$(ref).prop('src', e.target.result);
}
reader.readAsDataURL(file.files[0]);
}
}
</script>
<script>
$("document").ready(function() {
fetch();
//automatic fetch
function fetch() {
var uid = $("#uid").val();
$.getJSON("json-fetch-contri.php?uid=" + uid, function(aryJson) {
if (aryJson.length == 0) {
alert("Please fill data!");
$("#update").attr("disabled", "true");
$("#btnSave").attr("disabled", "false");
return;
}
$("#update").prop("disabled", false);
$("#btnsave").prop("disabled", true);
$("#name").val(aryJson[0].name);
$("#mobile").val(aryJson[0].mobile);
$("#firmname").val(aryJson[0].firmname);
$("#estd").val(aryJson[0].estd);
$("#firmaddress").val(aryJson[0].firmaddress);
$("#officemob").val(aryJson[0].officemob);
$("#state").val(aryJson[0].state);
$("#city").val(aryJson[0].city);
var pic1 = aryJson[0].picname1;
$("#prev1").prop("src", "cont-images/" + pic1);
$("#hdn1").val(pic1);
var pic2 = aryJson[0].picname2;
$("#prev2").prop("src", "cont-images/" + pic2);
$("#hdn2").val(pic2);
var pic3 = aryJson[0].picname3;
$("#prev3").prop("src", "cont-images/" + pic3);
$("#hdn3").val(pic3);
});
}
});
</script>
<style>
body {
background-image: url(pics/wallpaper3.jpg);
background-size: cover;
overflow-x: hidden;
}
</style>
</head>
<body>
<!--/* row 1*/-->
<div class="row">
<div class="col-md-12 text-center">
<center>
<h4>
<font size="6" color="white"><u> Contributor's Profile </u></font>
</h4>
</center>
</div>
</div>
<br>
<!-- row 2-->
<div class="row mr-6 ml-5 mt-2 ">
<div class="col-md-8 offset-md-2 border" style="background-color:white;">
<form action="contributor-profile-process.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="hdn1" id="hdn1">
<input type="hidden" name="hdn2" id="hdn2">
<input type="hidden" name="hdn3" id="hdn3">
<!-- form row 1-->
<div class="form-row">
<div class="col-md-6">
<label for="">
<font size="5">User-id</font>
</label>
<input type="text" class="form-control" id="uid" name="uid" readonly value="<?php echo $_SESSION['uid']; ?>">
</div>
</div>
<!-- form row 2 -->
<div class="form-row mt-2">
<div class="col-md-6">
<label for="">
<font size="5">Name</font><small>*</small>
</label>
<input type="text" class="form-control" id="name" name="name" required pattern="^[A-Za-z -]+$">
</div>
<div class="col-md-6">
<label for="">
<font size="5">Mobile</font><small>*</small>
</label>
<input type="text" class="form-control" id="mobile" name="mobile" required pattern="^[6-9]{1}[0-9]{9}$">
</div>
</div>
<!-- form row 3-->
<div class="form-row mt-2">
<div class="col-md-8">
<label for="">
<font size="5">Business/Firm name</font><small>*</small>
</label>
<input type="text" class="form-control" id="firmname" name="firmname" required>
</div>
<div class="col-md-4">
<label for="">
<font size="5">Estd.</font><small>*</small>
</label>
<input type="text" class="form-control" placeholder="year" id="estd" name="estd" required pattern="^[0-9]{1}[0-9]{3}$">
</div>
</div>
<!-- form row 4-->
<div class="form-row mt-2">
<div class="col-md-12">
<label for="">
<font size="5">Firm address</font><small>*</small>
</label>
<input type="text" class="form-control" id="firmaddress" name="firmaddress" required>
</div>
</div>
<!-- form row 5 -->
<div class="form-row mt-2">
<div class="col-md-4">
<label for="">
<font size="5">Office no.</font><small>*</small>
</label>
<input type="text" class="form-control" id="officemob" name="officemob" required pattern="^[0-9]{}">
</div>
<div class="col-md-4">
<label for="">
<font size="5">State </font><small>*</small>
</label>
<select name="state" id="state" class="form-control" required>
<option value=""></option>
<option value="punjab">Punjab</option>
<option value="hp">Himachal</option>
<option value="rajasthan">Rajasthan</option>
</select>
</div>
<div class="col-md-4">
<label for="">
<font size="5">City</font><small>*</small>
</label>
<input type="text" class="form-control" id="city" name="city" required>
</div>
</div>
<!-- form row 6-->
<center>
<font size="5">Upload images:</font>
</center>
<div class="form-row">
<div class="col-md-4">
<img src="pics/gallery.png" alt="" id="prev1" name="prev1" width="200" height="200">
<input type="file" class="form-control" id="ppic1" name="ppic1" accept="image/*" style="border:0px;" onchange="showpreview(this,prev1);">
</div>
<div class="col-md-4">
<img src="pics/gallery.png" alt="" id="prev2" name="prev2" width="200" height="200">
<input type="file" class="form-control" id="ppic2" name="ppic2" accept="image/*" style="border:0px;" onchange="showpreview(this,prev2);">
</div>
<div class="col-md-4">
<img src="pics/gallery.png" alt="" id="prev3" name="prev3" width="200" height="200">
<input type="file" class="form-control" id="ppic3" name="ppic3" accept="image/*" style="border:0px;" onchange="showpreview(this,prev3);">
</div>
<br>
</div>
<!-- form row 7-->
<div class="form-row mt-4">
<div class="col-md-12 offset-md-4">
<input type="submit" value="save" name="btn" id="btnsave" class="btn btn-danger">
<input type="submit" value="update" name="btn" id="update" class="btn btn-danger ml-2">
<br><br>
</div>
</div>
</form>
</div>
</div>
</body>
</html>