conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$supplier_value='';
$address_value='';
$phone_number_value='';
$contact_value='';
$email_value='';
$other_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->updateSupplier");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'suppliers';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$supplier_value=$row['supplier'];
$address_value=$row['address'];
$phone_number_value=$row['phone_number'];
$contact_value=$row['contact'];
$email_value=$row['email'];
$other_value=$row['other'];
}
}
else
{
$display->displayTitle("$lang->addSupplier");
}
//creates a form object
$f1=new form('process_form_suppliers.php','POST','suppliers','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("$lang->supplierName:",'text','supplier',"$supplier_value",'24','150');
$f1->createInputField("$lang->address:",'text','address',"$address_value",'24','150');
$f1->createInputField("$lang->phoneNumber:",'text','phone_number',"$phone_number_value",'24','150');
$f1->createInputField("$lang->contact:",'text','contact',"$contact_value",'24','150');
$f1->createInputField("$lang->email: ",'text','email',"$email_value",'24','150');
$f1->createInputField("$lang->other: ",'text','other',"$other_value",'24','150');
//sends 2 hidden varibles needed for process_form_suppliers.php.
echo "
";
$f1->endForm();
$dbf->closeDBlink();
?>