conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$category_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateCategory");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'categories';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$category_value=$row['category'];
}
}
else
{
$display->displayTitle("$lang->addCategory");
}
//creates a form object
$f1=new form('process_form_categories.php','POST','categories','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("$lang->categoryName:",'text','category',"$category_value",'24','150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "
";
$f1->endForm();
$dbf->closeDBlink();
?>