| Current Path : /var/www/html/mmishra/mm/upp/admin/ |
| Current File : /var/www/html/mmishra/mm/upp/admin/latest.php |
<span style="color:green;font-weight:bolder;background-color:khaki;padding:5px">Latest</span>
<table id='khaki_box' width='100%'><tr id='row1'><td>
<table width='100%'>
<?php
include "db.php";
$link = dbConnect();
$my_pp_no = $_REQUEST['pp_no'];
if (isset($_POST['submit'])){
$name = $_POST['name'];
$date_birth = $_POST['date_birth'];
$address = $_POST['address'];
$cadre = $_POST['cadre'];
$rank = $_POST['rank'];
$honors = $_POST['honors'];
$postings = $_POST['postings'];
$note = $_POST['note'];
$message = $_POST['message'];
if (mysql_num_rows(mysql_query("select * from profiles where pp_no='$my_pp_no'", $link))){
//update
mysql_query("update profiles set name='$name',date_birth='$date_birth',address='$address',cadre='$cadre',rank='$rank',honors='$honors',postings='$postings',note='$note',message='$message' where pp_no='$my_pp_no'", $link);
}else{
//insert
mysql_query("insert into profiles values(NULL,'$pp_no','$name','$date_birth','$address','$cadre','$rank','$honors','$postings','$note','$message'", $link);
}
}$rs = mysql_query("select * from profiles order by cadre", $link);
if (!$rs){
echo "Profile not maintained";
exit;
}
$my_pp_no = $_REQUEST['pp_no'];
while ($o = mysql_fetch_object($rs)):
$pp_no = $o->pp_no;
$name = $o->name;
$date_birth = $o->date_birth;
$address = $o->address;
$cadre = $o->cadre;
$rank = $o->rank;
$honors = $o->honors;
$postings = $o->postings;
$note = $o->note;
$message = $o->message;
if ($pp_no == $my_pp_no):
?>
<tr><td>PP No.:</td><td colspan='2'><?=$pp_no?> <input type='hidden' name='pp_no' value='<?=$pp_no?>'>Photo <input type='file' name='my_photo'> <input type='submit' name='submit' value='UPLOAD'></td></tr>
<tr><td>Name:</td><td><input type='text' name='name' size='30' value='<?=$name?>'></td><td rowspan='6'><img src='image/<?=$pp_no?>.jpg' width='100' height='120'></td></tr>
<tr><td>Date of Birth:</td><td><input type='text' name='date_birth' size='10' value='<?=$date_birth?>'></td></tr>
<tr valign='top'><td>Address:</td><td><textarea name='address' rows='3' cols='50%'><?=$address?></textarea></td></tr>
<tr><td>Cadre:</td><td><input type='text' name='cadre' size='30' value='<?=$cadre?>'></td></tr>
<tr><td>Rank:</td><td><input type='text' name='rank' size='30' value='<?=$rank?>'></td></tr>
<tr><td>Honors/Decorations:</td><td><input type='text' name='honors' size='30' value='<?=$honors?>'></td></tr>
<tr valign='top'><td>Previous Postings:</td><td colspan='2'><textarea name='postings' rows='10' cols='98%'><?=$postings?></textarea></td></tr>
<tr valign='top'><td>Note:</td><td colspan='2'><textarea name='note' rows='10' cols='98%'><?=$note?></textarea></td></tr>
<tr valign='top'><td>Message:</td><td colspan='2'><textarea name='message' rows='10' cols='98%'><?=$message?></textarea></td></tr>
<tr><td colspan='3' align='center'><input type='submit' name='submit' value='SAVE'></td></tr>
<?else:?>
<tr><td>PP No.:</td><td><?=$pp_no?></td><td widt'100'><?if (isset($_SESSION['full_name']) && $_SESSION['role'] == 'admin') echo "<a href='" . $_SERVER['PHP_SELF'] ."?url=$url&pp_no=$pp_no'>Edit Profile</a>"?></td></tr>
<tr><td>Name:</td><td><?=$name?></td><td rowspan='6'><img src='image/<?=$pp_no?>.jpg' width='100' height='120'></td></tr>
<tr><td>Date of Birth:</td><td><?=$date_birth?></td></tr>
<tr><td>Address:</td><td><?=$address?></td></tr>
<tr><td>Cadre:</td><td><?=$cadre?></td></tr>
<tr><td>Rank:</td><td><?=$rank?></td></tr>
<tr><td>Honors/Decorations:</td><td><?=$honors?></td></tr>
<tr><td>Previous Postings:</td><td colspan='2'><?=$postings?></td></tr>
<tr><td>Note:</td><td colspan='2'><?=$note?></td></tr>
<tr><td>Message:</td><td colspan='2'><?=$message?></td></tr>
<?php endif;
endwhile ?>
</table>
</td></tr></table>