<?php session_start();  //Developed by ITechScripts
require 'include/configurations.php'; // ITECHBIDS Configuration File
$frm=$_POST["cate"];
$category=$_POST["cat"];
$ser=$_POST["ser"];
$mode=$_REQUEST[mode];
$categoryid=$_REQUEST['id'];
require 'include/header.php';
if($mode=='edit')
{
$cat_sql="select * from help_categories where category_id=$categoryid";
$cat_res=mysql_query($cat_sql);
$cat_row=mysql_fetch_array($cat_res);
}
if($frm==1)
{
      if($mode=="edit")
       {
         $sql1="update help_categories set category_name='$category',serial='$ser' where category_id=$categoryid";
         $res1=mysql_query($sql1);
	   }
      else
      {
          $sql="insert into help_categories(category_name,serial) values('$category','$ser')";
         $res=mysql_query($sql);
		 	 
      }
	  
    echo '<meta http-equiv="refresh" content="0;url=help_cat.php">';
}
 
?>
<html>
<body>
<form action="addhelp_cat.php" method="post">

  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <table align="center" class="ft" width=600>
<td colspan="2" class="ct" height="25" align="left">
<? 
if($mode=='edit')
{
echo ("Edit Category");
}
else
{
echo ("Add Category");
}
?>
</td>
<tr height="25" >
<td align="center"  > <span height="25"><BR>
Category Name</span>&nbsp;&nbsp;
<input type="text" class="bluetext"name="cat" value="<?=$cat_row[category_name];?>" style="width:300;" >

<br>
<input type="hidden" name="cate" value=1>
<input type="hidden" name="mode" value=<?= $mode;?> >
<input type="hidden" name="id" value=<?= $categoryid;?> >
</td></tr>
<tr height="25" >
<td align="center"  > <span height="25"><BR>
Serial</span>&nbsp;&nbsp;
<input type="text" class="bluetext"name="ser" value="<?=$cat_row[serial];?>" style="width:30;" >
<br><br><input  type="submit" class="button" name="add" value="Submit" >
</td></tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form></body></html>
<?
	require 'include/footer.php';
?>