| Author: Pradeep Iyer 01 Nov 2008 | Member Level: Diamond | Rating: Points: 0 |
<?php include('Session.php'); ?> <?php require_once('dbcon.php'); include('chk_session.php'); $source_id=$_REQUEST["source_id"]; $cat=$_REQUEST["cat"];
if($cat=="ups") { $selectsource="select Source_Code,Source_Description from source_code_mst where source_id=$source_id"; $result=mysql_query($selectsource); if($row1=mysql_fetch_array($result)) { $Source_Code=removetld($row1["Source_Code"]); $Source_Description=removetld($row1["Source_Description"]); } $insertSQL ="update source_code_mst set Source_Code='$Source_Code', Source_Description='$Source_Description' where source_id='$source_id'"; if($Result1 = mysql_query($insertSQL)); { $st="ups"; } } else if($cat=="ins") { $Source_Code=$_REQUEST["Source_Code"]; $Source_Description=$_REQUEST["Source_Description"]; $sql="select count(*) as max from source_code_mst where Source_Code='$Source_Code'"; $ss=mysql_query($sql); $rs=mysql_fetch_array($ss); if($rs["max"]>0) { $st="ex"; } else { $insertSQL = "INSERT INTO source_code_mst (Source_Code,Source_Description) VALUES ('$Source_Code','$Source_Description')"; if ($Result1 = mysql_query($insertSQL)) { $st="ins"; } else { $st="er"; } }
}
if($_REQUEST["cat"]=="act") {
$insertSQL = "update source_code_mst set status=1 where source_id='$source_id'"; if ($Result1 = mysql_query($insertSQL)) { $st="act"; } else { $st="er"; } } if($_REQUEST["cat"]=="deact") { $insertSQL = "update source_code_mst set status=0 where source_id='$source_id'"; if ($Result1 = mysql_query($insertSQL)) { $st="deact"; } else { $st="er"; } } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="Content.IE5/WX27WDE3/includes/newie.css"><title>Admin Panel</title>
<script language="javascript"> function validation() { if(document.frm.Source_Code.value=="") { alert("Please Enter the Source Code"); document.frm.Source_Code.focus(); return false; } else if(document.frm.Source_Description.value=="") { alert("Please Enter the Source Description"); document.frm.Source_Description.focus(); return false; } } </script> <script language="javascript"> function onload() { document.frm.Source_Code.focus(); }
</script>
</head> <body> <form id="frm" name="frm" action="Sourcecodemst.php" method="post" class="onload()"> <table width="727" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffFF"> <tr> <td colspan="2"> <?php include('menu.php');?> </td> </tr> <tr> <td colspan="2"> <?php include('menu2.php');?> </td> </tr>
<tr> <td width="170" height="169" align="center" valign="top" nowrap="nowrap"> <?php include('menu3.php');?> </td> <td width="579" align="center" valign="top"> <br> <table width="85%" border="1" cellpadding="0" cellspacing="0" bordercolor="#0099FF" > <tr> <td> <font color="#0099FF" class="subheading"><strong>Manage Source Code </strong>Fields marked with(<span class="subcontent"><font color="#FF0000" >*</font></span>) must entered</font> <table align="center"> <tr valign="baseline"> <td height="22" colspan="2" align="center" valign="middle" nowrap class="msgcontent"> <?php
if($st=="ins") echo "Inserted Successfully"; if($st=="ups") echo "Update Successfully"; if($st=="ex") echo "Exists Already"; if($st=="er") echo "Someproblem on DB"; if($st=="act") echo "Activate Successfully"; if($st=="deact") echo "Deactivate Successfully"; ?> </td> </tr> <tr valign="baseline"> <td align="left" valign="middle" nowrap class="subcontent"><font color="#FF0000" >*</font>Source Code:</span></td> <td><input name="Source_Code" type="text" class="content" value="<?php echo $Source_Code ?>" size="25""></td> </tr> <tr valign="baseline"> <td align="left" valign="middle" nowrap class="subcontent"><font color="#FF0000">*</font>Source Description</strong>:</span></td> <td><input name="Source_Description" type="text" class="content" value="<?php echo $Source_Description ?> " size="25"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td>
<td><input name="submit" type="submit" value="Submit" class="buttonSubmit" onClick="return validation();"></td> </tr> </table> </td> </tr> </table>
<br>
<table width="528" height="60" border="1" cellpadding="0" cellspacing="0" bordercolor="#0099FF" > <tr> <th width="524" scope="col">
<table width="105%" border="0" cellpadding="0" cellspacing="0"> <tr bordercolor="#CCCCCC" bgcolor="#99CCCC"> <td width="103" align="center" class="grdheading">Source Code</td> <td width="150" align="center" class="grdheading">Source Description</td> <td width="67" align="center" class="grdheading">Status</td> <td width="101" align="center" class="grdheading">Action</td> </tr> <?php $ch = "SELECT * FROM source_code_mst order by Source_Code asc";
$sorcecodeset=mysql_query($ch); $cnt=0; while($rowsorcecodeset=mysql_fetch_assoc($sorcecodeset)) {
$cnt=$cnt+1; if($cnt%2==0) $bg="#CCCCCC"; else $bg="#DDEBEE";
?>
<td class="content" align="center"><a href="Sourcecodemst.php?source_id=<?php echo $rowsorcecodeset['source_id'] ?>"> <?php echo $rowsorcecodeset['Source_Code']; ?></td> <td class="content" align="center"><?php echo $rowsorcecodeset['Source_Description']; ?></td> <td class="content" align="center"><?php if($rowsorcecodeset['status']=="1") echo "Active"; else echo "Deactivate"; ?> </td> <td class="content" align="center"> <?php if($rowsorcecodeset['status']=="1") { ?> <a href='Sourcecodemst.php?cat=deact&source_id=<?php echo $rowsorcecodeset['source_id'];?>'>Deactivate<a href='Sourcecodemst.php?cat=act&source_id=<?php echo $rowsorcecodeset['source_id'];?>'></a> <?php } else { ?> Active <?php } ?> </td> </tr> <?php }; ?> </table></th> </tr> </table> <br></td> </tr> <tr height="25px"> <td colspan="2" bgcolor="#FFAC1B"></td> </tr> </table> <input type="hidden" id="cat" name="cat" value="ins"> </form> </body> </html>
Regards, Pradeep Iyer
|