Example #1
0
        $row = mysql_fetch_assoc($result);
        $first_name_value = $row['first_name'];
        $last_name_value = $row['last_name'];
        $account_number_value = $row['account_number'];
        $phone_number_value = $row['phone_number'];
        $email_value = $row['email'];
        $street_address_value = $row['street_address'];
        $comments_value = $row['comments'];
    }
} else {
    $display->displayTitle("{$lang->addCustomer}");
}
//creates a form object
$f1 = new form('process_form_customers.php', 'POST', 'customers', '450', $cfg_theme, $lang);
//creates form parts.
$f1->createInputField("<b>{$lang->firstName}:</b> ", 'text', 'first_name', "{$first_name_value}", '24', '150');
$f1->createInputField("<b>{$lang->lastName}:</b> ", 'text', 'last_name', "{$last_name_value}", '24', '150');
$f1->createInputField("{$lang->accountNumber}: ", 'text', 'account_number', "{$account_number_value}", '24', '150');
$f1->createInputField("<b>{$lang->phoneNumber}</b> ", 'text', 'phone_number', "{$phone_number_value}", '24', '150');
$f1->createInputField("{$lang->email}:", 'text', 'email', "{$email_value}", '24', '150');
$f1->createInputField("{$lang->streetAddress}:", 'text', 'street_address', "{$street_address_value}", '24', '150');
$f1->createInputField("{$lang->commentsOrOther}:", 'text', 'comments', "{$comments_value}", '40', '150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>

Example #2
0
        $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("<b>{$lang->supplierName}:</b>", 'text', 'supplier', "{$supplier_value}", '24', '150');
$f1->createInputField("<b>{$lang->address}:</b>", 'text', 'address', "{$address_value}", '24', '150');
$f1->createInputField("<b>{$lang->phoneNumber}:</b>", 'text', 'phone_number', "{$phone_number_value}", '24', '150');
$f1->createInputField("<b>{$lang->contact}:</b>", '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 "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>	


Example #3
0
include "../language/{$cfg_language}";
include "../classes/db_functions.php";
include "../classes/security_functions.php";
include "../classes/display.php";
include "../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageItems}");
$f1 = new form('manage_items.php', 'POST', 'items', '400', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForItemBy}</b>", 'text', 'search', '', '24', '150');
$option_values2 = array('item_name', 'item_number', 'id', 'quantity', 'supplier_catalogue_number');
$option_titles2 = array("{$lang->itemName}", "{$lang->itemNumber}", 'ID', "{$lang->quantityStock}", "{$lang->supplierCatalogue}");
$f1->createSelectField("<b>{$lang->searchBy}</b>", 'searching_by', $option_values2, $option_titles2, 100);
$f1->endForm();
echo "<a href='manage_items.php?outofstock=go'>{$lang->showOutOfStock}</a><br>";
echo "<a href='manage_items.php?reorder=go'>{$lang->showReorder}</a>";
$tableheaders = array("{$lang->rowID}", "{$lang->itemName}", "{$lang->itemNumber}", "{$lang->description}", "{$lang->brand}", "{$lang->category}", "{$lang->supplier}", "{$lang->buyingPrice}", "{$lang->sellingPrice}", "{$lang->tax} {$lang->percent}", "{$lang->finalSellingPricePerUnit}", "{$lang->quantityStock}", "{$lang->reorderLevel}", "{$lang->supplierCatalogue}", "{$lang->updateItem}", "{$lang->deleteItem}");
$tablefields = array('id', 'item_name', 'item_number', 'description', 'brand_id', 'category_id', 'supplier_id', 'buy_price', 'unit_price', 'tax_percent', 'total_cost', 'quantity', 'reorder_level', 'supplier_catalogue_number');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    $searching_by = $_POST['searching_by'];
    echo "<center>{$lang->searchedForItem}: <b>{$search}</b> {$lang->searchBy} <b>{$searching_by}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'items', $tableheaders, $tablefields, "{$searching_by}", "{$search}", 'id');
} elseif (isset($_GET['outofstock'])) {
    echo "<center>{$lang->outOfStock}</b></center>";
Example #4
0
include "../language/{$cfg_language}";
include "../classes/db_functions.php";
include "../classes/security_functions.php";
include "../classes/display.php";
include "../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Sales Clerk', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageCustomers}");
$f1 = new form('manage_customers.php', 'POST', 'customers', '450', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForCustomer}</b>", 'text', 'search', '', '24', '150');
$option_values2 = array('first_name', 'last_name', 'account_number', 'id');
$option_titles2 = array("{$lang->firstName}", "{$lang->lastName}", "{$lang->accountNumber}", 'ID');
$f1->createSelectField("<b>{$lang->searchBy}</b>", 'searching_by', $option_values2, $option_titles2, 100);
$f1->endForm();
$tableheaders = array("{$lang->rowID}", "{$lang->lastName}", "{$lang->firstName}", "{$lang->accountNumber}", "{$lang->phoneNumber}", "{$lang->email}", "{$lang->streetAddress}", "{$lang->commentsOrOther}", "{$lang->updateCustomer}", "{$lang->deleteCustomer}");
$tablefields = array('id', 'last_name', 'first_name', 'account_number', 'phone_number', 'email', 'street_address', 'comments');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    $searching_by = $_POST['searching_by'];
    echo "<center>{$lang->searchedForItem}: <b>{$search}</b> {$lang->searchBy} <b>{$searching_by}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'customers', $tableheaders, $tablefields, "{$searching_by}", "{$search}", 'last_name');
} else {
    $display->displayManageTable("{$cfg_tableprefix}", 'customers', $tableheaders, $tablefields, '', '', 'last_name');
}
$dbf->closeDBlink();
Example #5
0
$comment_value = '';
$id = -1;
//decides if the form will be used to update or add a user.
$display->displayTitle("Update Sale");
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $tablename = "{$cfg_tableprefix}" . 'sales';
    $result = mysql_query("SELECT * FROM {$tablename} WHERE id=\"{$id}\"", $dbf->conn);
    $row = mysql_fetch_assoc($result);
    $paid_with_value = $row['paid_with'];
    $comment_value = $row['comment'];
}
//creates a form object
$f1 = new form('process_update_sale.php', 'POST', 'sale', '325', $cfg_theme, $lang);
//creates form parts.
echo "<br><br><center><b>{$lang->updateSaleID} {$id}</b></center>";
$option_values = array("{$paid_with_value}", 'Cash', 'Check', 'Credit', 'Gift Certificate', 'Account', 'Other');
$option_titles = array("{$paid_with_value}", $lang->cash, $lang->check, $lang->credit, $lang->giftCertificate, $lang->account, $lang->other);
$f1->createSelectField("<b>{$lang->paidWith}:</b>", 'paid_with', $option_values, $option_titles, '130');
$f1->createInputField("<b>{$lang->saleComment}:</b>", 'text', 'comment', "{$comment_value}", '24', '180');
echo "\t\t\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
	
</body>
</html>



Example #6
0
        $buy_price_value = $row['buy_price'];
        $unit_price_value = $row['unit_price'];
        $supplier_catalogue_number_value = $row['supplier_catalogue_number'];
        $tax_percent_value = $row['tax_percent'];
        $total_cost_value = $row['total_cost'];
        $quantity_value = $row['quantity'];
        $reorder_level_value = $row['reorder_level'];
        $id = $row['id'];
    }
} else {
    $display->displayTitle("{$lang->addItem}");
}
//creates a form object
$f1 = new form('process_form_items.php', 'POST', 'items', '400', $cfg_theme, $lang);
//creates form parts.
$f1->createInputField("<b>{$lang->itemName}:</b> ", 'text', 'item_name', "{$item_name_value}", '24', '160');
$f1->createInputField("{$lang->description}: ", 'text', 'description', "{$description_value}", '24', '160');
$f1->createInputField("{$lang->itemNumber}: ", 'text', 'item_number', "{$item_number_value}", '24', '160');
$brandtable = "{$cfg_tableprefix}" . 'brands';
$brand_option_titles = $dbf->getAllElements("{$brandtable}", 'brand', 'brand');
$brand_option_titles[0] = $dbf->idToField("{$brandtable}", 'brand', "{$brand_id_value}");
$brand_option_values = $dbf->getAllElements("{$brandtable}", 'id', 'brand');
$brand_option_values[0] = $brand_id_value;
$f1->createSelectField("<b>{$lang->brand}:</b>", 'brand_id', $brand_option_values, $brand_option_titles, '160');
$categorytable = "{$cfg_tableprefix}" . 'categories';
$category_option_titles = $dbf->getAllElements("{$categorytable}", 'category', 'category');
$category_option_titles[0] = $dbf->idToField("{$categorytable}", 'category', "{$category_id_value}");
$category_option_values = $dbf->getAllElements("{$categorytable}", 'id', 'category');
$category_option_values[0] = $category_id_value;
$f1->createSelectField("<b>{$lang->category}:</b>", 'category_id', $category_option_values, $category_option_titles, '160');
$suppliertable = "{$cfg_tableprefix}" . 'suppliers';
Example #7
0
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
//checks if user is logged in.
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
$display->displayTitle("{$lang->updateItem}");
if (isset($_GET['item_id']) and isset($_GET['sale_id']) and isset($_GET['row_id'])) {
    $item_id = $_GET['item_id'];
    $sale_id = $_GET['sale_id'];
    $row_id = $_GET['row_id'];
    $tablename = "{$cfg_tableprefix}" . 'sales_items';
    $result = mysql_query("SELECT * FROM {$tablename} WHERE id=\"{$row_id}\"", $dbf->conn);
    $row = mysql_fetch_assoc($result);
    $quantity_purchased_value = $row['quantity_purchased'];
    $item_unit_price_value = $row['item_unit_price'];
    $item_tax_percent_value = $row['item_tax_percent'];
}
//creates a form object
$f1 = new form('process_update_item.php', 'POST', 'sale item', '335', $cfg_theme, $lang);
//creates form parts.
echo "<br><br><center><b>{$lang->updateRowID} {$row_id}</b></center>";
$f1->createInputField("<b>{$lang->quantityPurchased}:</b>", 'text', 'quantity_purchased', "{$quantity_purchased_value}", '24', '160');
$f1->createInputField("<b>{$lang->unitPrice}:</b> ", 'text', 'item_unit_price', "{$item_unit_price_value}", '24', '160');
$f1->createInputField("<b>{$lang->tax} %:</b> ", 'text', 'item_tax_percent', "{$item_tax_percent_value}", '24', '160');
echo "\t\t\n\t\t<input type='hidden' name='row_id' value='{$row_id}'>\n\t\t<input type='hidden' name='item_id' value='{$item_id}'>\n\t\t<input type='hidden' name='sale_id' value='{$sale_id}'>\n\t\t<input type='hidden' name='old_quantity' value='{$quantity_purchased_value}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
Example #8
0
include "../../settings.php";
include "../../language/{$cfg_language}";
include "../../classes/db_functions.php";
include "../../classes/security_functions.php";
include "../../classes/display.php";
include "../../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageBrands}");
$f1 = new form('manage_brands.php', 'POST', 'brands', '425', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForBrand}</b>", 'text', 'search', '', '24', '350');
$f1->endForm();
$tableheaders = array("{$lang->rowID}", "{$lang->brandName}", "{$lang->updateBrand}", "{$lang->deleteBrand}");
$tablefields = array('id', 'brand');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    echo "<center>{$lang->searchedForBrand}: <b>{$search}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'brands', $tableheaders, $tablefields, 'brand', "{$search}", 'brand');
} else {
    $display->displayManageTable("{$cfg_tableprefix}", 'brands', $tableheaders, $tablefields, '', '', 'brand');
}
$dbf->closeDBlink();
?>
</body>
</html>
Example #9
0
include "../settings.php";
include "../language/{$cfg_language}";
include "../classes/db_functions.php";
include "../classes/security_functions.php";
include "../classes/display.php";
include "../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageUsers}");
$f1 = new form('manage_users.php', 'POST', 'users', '400', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForUser}</b>", 'text', 'search', '', '24', '300');
$f1->endForm();
$tableheaders = array("{$lang->rowID}", "{$lang->lastName}", "{$lang->firstName}", "{$lang->username}", "{$lang->password}", "{$lang->type}", "{$lang->updateUser}", "{$lang->deleteUser}");
$tablefields = array('id', 'last_name', 'first_name', 'username', 'password', 'type');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    echo "<center>{$lang->searchedForUser}:<b> {$search}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'users', $tableheaders, $tablefields, 'username', "{$search}", 'last_name');
} else {
    $display->displayManageTable("{$cfg_tableprefix}", 'users', $tableheaders, $tablefields, '', '', 'last_name');
}
$dbf->closeDBlink();
?>
</body>
</html>
Example #10
0
include "../../settings.php";
include "../../language/{$cfg_language}";
include "../../classes/db_functions.php";
include "../../classes/security_functions.php";
include "../../classes/display.php";
include "../../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageSuppliers}");
$f1 = new form('manage_suppliers.php', 'POST', 'suppliers', '475', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForSupplier}</b>", 'text', 'search', '', '24', '375');
$f1->endForm();
$tableheaders = array("{$lang->rowID}", "{$lang->supplierName}", "{$lang->address}", "{$lang->phoneNumber}", "{$lang->contact}", "{$lang->email}", "{$lang->other}", "{$lang->updateSupplier}", "{$lang->deleteSupplier}");
$tablefields = array('id', 'supplier', 'address', 'phone_number', 'contact', 'email', 'other');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    echo "<center>{$lang->searchedForSupplier}: <b>{$search}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'suppliers', $tableheaders, $tablefields, 'supplier', "{$search}", 'supplier');
} else {
    $display->displayManageTable("{$cfg_tableprefix}", 'suppliers', $tableheaders, $tablefields, '', '', 'supplier');
}
$dbf->closeDBlink();
?>
</body>
</html>
Example #11
0
include "../language/{$cfg_language}";
include "../classes/db_functions.php";
include "../classes/security_functions.php";
include "../classes/display.php";
include "../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageSales}");
$f1 = new form('manage_sales.php', 'POST', 'sales', '450', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForSale}</b>", 'text', 'search', "{$lang->highID}" . '-' . "{$lang->lowID}", '24', '350');
$f1->endForm();
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    $temp_search = explode('-', $search);
    if (!ereg('-', $search)) {
        echo '<center><b></b></center>';
        exit;
    }
    $id1 = $temp_search[0];
    $id2 = $temp_search[1];
    if ($id1 < $id2) {
        echo "<center><b>{$lang->incorrectSearchFormat}(ex: {$id2}-{$id1})</b></center>";
        exit;
    }
    echo "<center>{$lang->searchedForSales} id's <b>{$id1} {$lang->and} {$id2}:</b></center>";
Example #12
0
    $action = "insert";
}
//if action is update, sets variables to what the current users data is.
if ($action == "update") {
    $display->displayTitle("{$lang->updateBrand}");
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
        $tablename = "{$cfg_tableprefix}" . 'brands';
        $result = mysql_query("SELECT * FROM {$tablename} WHERE id=\"{$id}\"", $dbf->conn);
        $row = mysql_fetch_assoc($result);
        $brand_value = $row['brand'];
    }
} else {
    $display->displayTitle("{$lang->addBrand}");
}
//creates a form object
$f1 = new form('process_form_brands.php', 'POST', 'brands', '300', $cfg_theme, $lang);
//creates form parts.
$f1->createInputField("<b>{$lang->brandName}:</b>", 'text', 'brand', "{$brand_value}", '24', '150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
	
</body>
</html>



Example #13
0
        $row = mysql_fetch_assoc($result);
        $item_id_value = $row['item_id'];
        $percent_off_value = $row['percent_off'];
        $comment_value = $row['comment'];
    }
} else {
    $display->displayTitle("{$lang->addDiscount}");
}
//creates a form object
$f1 = new form('process_form_discounts.php', 'POST', 'discounts', '300', $cfg_theme, $lang);
//creates form parts.
$itemtable = "{$cfg_tableprefix}" . 'items';
$item_option_titles = $dbf->getAllElements("{$itemtable}", 'item_name', 'item_name');
$item_option_titles[0] = $dbf->idToField("{$itemtable}", 'item_name', "{$item_id_value}");
$item_option_values = $dbf->getAllElements("{$itemtable}", 'id', 'item_name');
$item_option_values[0] = $item_id_value;
$f1->createSelectField("<b>{$lang->itemName}:</b>", 'item_id', $item_option_values, $item_option_titles, '160');
$f1->createInputField("<b>{$lang->percentOff}: (%)</b> ", 'text', 'percent_off', "{$percent_off_value}", '24', '150');
$f1->createInputField("{$lang->comment}: ", 'text', 'comment', "{$comment_value}", '24', '150');
//sends 2 hidden varibles needed for process_form_discounts.php.
echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>	




Example #14
0
include "../../settings.php";
include "../../language/{$cfg_language}";
include "../../classes/db_functions.php";
include "../../classes/security_functions.php";
include "../../classes/display.php";
include "../../classes/form.php";
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
if (!$sec->isLoggedIn()) {
    header("location: ../../login.php");
    exit;
}
$display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang);
$display->displayTitle("{$lang->manageDiscounts}");
$f1 = new form('manage_discounts.php', 'POST', 'discounts', '475', $cfg_theme, $lang);
$f1->createInputField("<b>{$lang->searchForDiscount}</b>", 'text', 'search', '', '24', '375');
$f1->endForm();
$tableheaders = array("{$lang->rowID}", "{$lang->itemName}", "{$lang->percentOff}", "{$lang->comment}", "{$lang->updateDiscount}", "{$lang->deleteDiscount}");
$tablefields = array('id', 'item_id', 'percent_off', 'comment');
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    echo "<center>{$lang->searchedForDiscount}: <b>{$search}</b></center>";
    $display->displayManageTable("{$cfg_tableprefix}", 'discounts', $tableheaders, $tablefields, 'percent_off', "{$search}", 'percent_off');
} else {
    $display->displayManageTable("{$cfg_tableprefix}", 'discounts', $tableheaders, $tablefields, '', '', 'percent_off');
}
$dbf->closeDBlink();
?>
</body>
</html>
Example #15
0
    $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("<b>{$lang->categoryName}:</b>", 'text', 'category', "{$category_value}", '24', '150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>	




Example #16
0
        $tablename = "{$cfg_tableprefix}" . 'users';
        $result = mysql_query("SELECT * FROM {$tablename} WHERE id=\"{$id}\"", $dbf->conn);
        $row = mysql_fetch_assoc($result);
        $first_name_value = $row['first_name'];
        $last_name_value = $row['last_name'];
        $username_value = $row['username'];
        $password_value = "*notchanged*";
        $type_value = $row['type'];
    }
} else {
    $display->displayTitle("{$lang->addUser}");
}
//creates a form object
$f1 = new form('process_form_users.php', 'POST', 'users', '415', $cfg_theme, $lang);
//creates form parts.
$f1->createInputField("<b>{$lang->firstName}:</b>", 'text', 'first_name', "{$first_name_value}", '24', '180');
$f1->createInputField("<b>{$lang->lastName}:</b>", 'text', 'last_name', "{$last_name_value}", '24', '180');
$f1->createInputField("<b>{$lang->username}:</b><i>({$lang->usedInLogin})</i>", 'text', 'username', "{$username_value}", '24', '180');
$option_values = array("{$type_value}", 'Admin', 'Sales Clerk', 'Report Viewer');
$option_titles = array("{$type_value}", "{$lang->admin}", "{$lang->salesClerk}", "{$lang->reportViewer}");
$f1->createSelectField("<b>{$lang->type}:</b> ", 'type', $option_values, $option_titles, '180');
$f1->createInputField("<b>{$lang->password}:</b>", 'password', 'password', "{$password_value}", '24', '180');
$f1->createInputField("<b>{$lang->confirmPassword}:</b>", 'password', 'cpassword', "{$password_value}", '24', '180');
//sends 2 hidden varibles needed for process_form_users.php.
echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>