-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditofficer.php
223 lines (213 loc) · 10.4 KB
/
editofficer.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
<?php
error_reporting(0);
ob_start();
include("header.php");
include("config.php");
$username = $_GET['username'];
$selectQuery = "select *from mstr_officer mo,mstr_profile mp where mp.username = '".$username."' and mp.username = mo.username ";
//echo $selectQuery;
$rs = mysql_query($selectQuery);
$record = mysql_fetch_array($rs);
if(mysql_num_rows($rs)==0)
header("location:viewofficer.php");
?>
<body>
<h1>officer Information</h1>
<form name="frmofficer" action="updateofficer.php" method="post">
<table>
<tr>
<th colspan="3" class="first"><strong>officer informaion</strong></th>
</tr>
<tr>
<td width="165" align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style3">First Name: </span>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<span class="style3">
<input type="text" value="<?php echo $record["first_name"]; ?>" name="fname" />
<script type="text/javascript">
var f1 = new LiveValidation('fname');
f1.add(Validate.Presence,{failureMessage: " Please enter Firstname"});
f1.add(Validate.Format,{pattern: /^[a-zA-Z\s]+$/i ,
failureMessage:" It allows only characters"});
f1.add(Validate.Format,{pattern: /^[a-zA-Z][a-zA-Z\s]{0,}$/,
failureMessage:" Invalid Firstname"});
</script>
</span></td>
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Middle Name: </span>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<label>
<input type="text" value="<?php echo $record["middle_name"]; ?>" name="mname" />
<script type="text/javascript">
var f1 = new LiveValidation('mname');
f1.add(Validate.Presence,{failureMessage: " Please enter Middlename"});
//f1.add(Validate.Format,{pattern: /^[a-zA-Z\s]+$/i ,failureMessage:
// " It allows only characters"});
f1.add(Validate.Format,{pattern: /^[a-zA-Z][a-zA-Z\s]{0,}$/,
failureMessage:" Invalid Middlename"});
</script>
</label>
</span></td>
</tr>
<tr>
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Last Name:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<label>
<input type="text" value="<?php echo $record["last_name"]; ?>" name="lname" />
<script type="text/javascript">
var f1 = new LiveValidation('lname');
f1.add(Validate.Presence,{failureMessage: " Please enter Lastname"});
//f1.add(Validate.Format,{pattern: /^[a-zA-Z\s]+$/i ,failureMessage:
// " It allows only characters"});
f1.add(Validate.Format,{pattern: /^[a-zA-Z][a-zA-Z\s]{0,}$/,
failureMessage:"Invalid Lastname"});
</script>
</label>
</span></td>
</tr>
<tr bgcolor="#999999">
<td height="28" align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Gender:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<span class="style15 style3">
<label>
<input type="radio" name="gender" value="Male" <?php if($record["gender"]=="Male") echo "checked = 'checked'"?>>Male</label>
<label>
<input type="radio" name="gender" value="Female" <?php if($record["gender"]=="Female") echo "checked = 'checked'"?> >Female</label>
</span></td>
</tr>
<tr>
<td height="60" align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000"> Address:</span>
<td width="207" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<label>
<TEXTAREA ROWS="5" COLS="30" name="address" id="address" style="background-color: #EEEEEE" ><?php echo $record["address"]; ?></TEXTAREA>
<script type="text/javascript">
var f1 = new LiveValidation('address');
f1.add(Validate.Presence,{failureMessage: " Please enter Address"});
//f1.add(Validate.Format,{pattern: /^[a-zA-Z\s]+$/i ,failureMessage:
// " It allows only characters"});
//f1.add(Validate.Format,{pattern: /^[a-zA-Z][a-zA-Z\s]{0,}$/,failureMessage:
//" Invalid Address"});
</script>
</label>
</span></td>
<td width="74" align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">City:</span></td>
<td width="296" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<select name="city" size="1" id="city" >
<?php
$cityQuery = "select *from mstr_city";
$rsCity = mysql_query($cityQuery);
while($rowCity = mysql_fetch_array($rsCity))
{
?>
<option value="<?php echo $rowCity['city_id']?>" <?php if($record["city_id"]==$rowCity['city_id']) echo "selected"; ?>>
<?php echo $rowCity['city_name']?></option>
<?php }?>
<script type="text/javascript">
var f1 = new LiveValidation('city');
f1.add(Validate.Presence,{failureMessage: "Please enter city name"});
</script>
</select>
</span></td>
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Pin-code:</span></td>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<input type="text" value="<?php echo $record["pincode"]; ?>" name="pincode" />
<script type="text/javascript">
var f1 = new LiveValidation('pincode');
f1.add(Validate.Presence,{failureMessage: " It cannot be empty"});
f1.add(Validate.Format,{pattern: /^[0-9]+$/ ,
failureMessage: " It allows only numbers"});
f1.add( Validate.Length, { minimum: 6, maximum: 6 } );
</script>
</span></td>
</tr>
<tr bgcolor="#999999">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Contact number: </span>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<label>
<input type="text" value="<?php echo $record["contact_no"]; ?>" name="contactno" />
<script type="text/javascript">
var f1 = new LiveValidation('contactno');
f1.add(Validate.Presence,{failureMessage: " It cannot be empty"});
f1.add(Validate.Format,{pattern: /^[0-9]+$/ ,
failureMessage: " It allows only numbers"});
f1.add( Validate.Length, { minimum: 6, maximum: 12 } );
</script>
</label>
</span></td>
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Email-id:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<input type="text" value="<?php echo $record["emailid"]; ?>" name="emailid" />
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Joining Date:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<input type="text" value="<?php echo $record["Jdate"]; ?>" name="jdate" />
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Last Date:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<input type="text" value="<?php echo $record["Ldate"]; ?>" name="ldate" />
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Police station name:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<select name="psname" size="1" id="psname" >
<?php
$psQuery = "select *from mstr_policestation";
$rsPs = mysql_query($psQuery);
while($rowPs = mysql_fetch_array($rsPs))
{
?>
<option value="<?php echo $rowPs['policestation_id']?>"<?php if($record["poilcestation_id"]==$rowPs['poilcestation_id']) echo "selected"; ?>>
<?php echo $rowPs['policestation_name']?></option>
<?php }?>
<script type="text/javascript">
var f1 = new LiveValidation('psname');
f1.add(Validate.Presence,{failureMessage: "Please enter police station name"});
</script>
</select>
</span></td>
</tr>
<tr bgcolor="#993366">
<td align="right" valign="middle" bgcolor="#FFFFFF">
<span class="style19" style="color: #000000">Designation Name:</span>
<td colspan="3" align="left" bgcolor="#FFFFFF"><span class="style15 style3">
<select name="designation" size="1" id="designation" >
<?php
$desigQuery = "select *from mstr_designation";
$rsDesig = mysql_query($desigQuery);
while($rowDesig = mysql_fetch_array($rsDesig))
{
?>
<option value="<?php echo $rowDesig['desi_id']?>"<?php if($record["desi_id"]==$rowDesig['desi_id']) echo "selected"; ?>>
<?php echo $rowDesig['desi_name']?></option>
<?php }?>
<script type="text/javascript">
var f1 = new LiveValidation('designation');
f1.add(Validate.Presence,{failureMessage: "Please enter designation name"});
</script>
</select>
</span></td>
</tr>
<tr><td><input type="submit" value="Update" /></td>
</tr>
</table>
</form>
</body>
</html>