Location: PHPKode > projects > CoreAsset > coreasset/edit_category.php
<?php
require_once("lib/inc.php");
require_once("lib/security.php");

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Edit Category :::";
$smarty->assign('title',$title);
// Date & Time to be dispalyed on the header 
$date_time	= date("h:i:s A")." ".date("d-m-Y");
$smarty->assign('date_time',$date_time);
// Done
$date     = date("Y-m-d");
$status   = $_SESSION['status'];
$user_id  = $_SESSION['user_id'];
$smarty->assign('user_id',$user_id);
$row      = $database->get_from_database("select * from asset_users where user_id='$user_id'");
$name     = $row['full_name'];
$rw		  = $database->get_from_database("select * from asset_users where user_id='$_SESSION[user_id]'");
$last_login  = $rw['last_login'];
$last_logout = $rw['last_logout'];
$smarty->assign('last_login',$last_login);
$smarty->assign('last_logout',$last_logout);

if($status < 4)
{
  if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
  {
   $category_id                = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
   $row                        = $database->get_from_database("select * from asset_category where category_id='$category_id'");
   $category_name              = $row['category_name'];
   $category_description       = $row['category_description'];

   $smarty->assign('category_id',$category_id);
   $smarty->assign('category_name',$category_name);
   $smarty->assign('category_description',$category_description);
   }

  if(isset($_GET['act']))
  {
   if($_GET['act']=="edit")
   {
    $category_id              = $_POST['category_id'];
    $category_name            = $_POST['category_name'];
    $category_description     = $_POST['category_description'];

    if($database->update("update asset_category set category_name='$category_name', category_description='$category_description' where category_id='$category_id'"))
    {
     redirect ("manage_category.php","Edit");
    }
   }
  }
}

else
{
 $mes = "Sorry ! You have no such Privillage ...";
 $smarty->assign('mes',$mes);
}
$smarty->assign('name',$name);
$smarty->assign('status',$status);

$smarty->display('edit_category.tpl');
?>
Return current item: CoreAsset