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

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Edit Vendor :::";
$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']))
  {
   $vendor_id            = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
   $row                  = $database->get_from_database("select * from asset_vendor where vendor_id='$vendor_id'");
   $vendor_name          = $row['vendor_name'];
   $vendor_address       = $row['vendor_address'];
   $vendor_email         = $row['vendor_email'];
   $vendor_phone         = $row['vendor_phone'];
   $vendor_zip           = $row['vendor_zip'];
   $vendor_country       = $row['vendor_country'];
   $vendor_state         = $row['vendor_state'];
   $vendor_description   = $row['vendor_description'];

   $smarty->assign('vendor_id',$vendor_id);
   $smarty->assign('vendor_name',$vendor_name);
   $smarty->assign('vendor_address',$vendor_address);
   $smarty->assign('vendor_email',$vendor_email);
   $smarty->assign('vendor_phone',$vendor_phone);
   $smarty->assign('vendor_zip',$vendor_zip);
   $smarty->assign('vendor_country',$vendor_country);
   $smarty->assign('vendor_state',$vendor_state);
   $smarty->assign('vendor_description',$vendor_description);
   }

  if(isset($_GET['act']))
  {
   if($_GET['act']=="edit")
   {
   $vendor_id            = $_POST['vendor_id'];
   $vendor_name          = $_POST['vendor_name'];
   $vendor_address       = $_POST['vendor_address'];
   $vendor_email         = $_POST['vendor_email'];
   $vendor_phone         = $_POST['vendor_phone'];
   $vendor_zip           = $_POST['vendor_zip'];
   $vendor_country       = $_POST['vendor_country'];
   $vendor_state         = $_POST['vendor_state'];
   $vendor_description   = $_POST['vendor_description'];

    if($database->update("update asset_vendor set vendor_name='$vendor_name', vendor_address='$vendor_address', vendor_email='$vendor_email', vendor_phone='$vendor_phone', vendor_zip='$vendor_zip', vendor_country='$vendor_country', vendor_state='$vendor_state', vendor_description='$vendor_description'  where vendor_id='$vendor_id'"))
    {
     redirect ("manage_vendor.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_vendor.tpl');
?>
Return current item: CoreAsset