Hi,
With limited PHP knowledge, I am trying to create a new module which allows to create a custom order from admin. I am stuck now for some time, trying to get this pull_down_menu customers box to populate.
What have I forgotten?
Here is my program code:
Any help is greatly appreciated, as I cannot finish any other part, as it will depend on a similar pull_down_menu.Code:<?php require ('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $action = (isset($_GET['action']) ? $_GET['action'] : ''); $customer_id = zen_db_prepare_input($_GET['cID']); // $product_id = zen_db_prepare_input($_GET['pID']); // $manufacturers_id = zen_db_prepare_input($_GET['mID']); // $quote_id = zen_db_prepare_input($_GET['qID']); // $order_id = zen_db_prepare_input($_GET['oID']); $error = false; $processed = false; if (zen_not_null($action)) { switch ($action) { case 'get_customer': $customers_firstname = zen_db_prepare_input($_POST['customers_firstname']); $customers_lastname = zen_db_prepare_input($_POST['customers_lastname']); $customers_email_address = zen_db_prepare_input($_POST['customers_email_address']); $customers_telephone = zen_db_prepare_input($_POST['customers_telephone']); $default_address_id = zen_db_prepare_input($_POST['default_address_id']); $entry_street_address = zen_db_prepare_input($_POST['entry_street_address']); $entry_suburb = zen_db_prepare_input($_POST['entry_suburb']); $entry_postcode = zen_db_prepare_input($_POST['entry_postcode']); $entry_city = zen_db_prepare_input($_POST['entry_city']); $entry_country_id = zen_db_prepare_input($_POST['entry_country_id']); $customer_info = $db->Execute("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_default_address_id, c.customers_email_format from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id order by c.customers_lastname where a.customers_id = c.customers_id and c.customers_id = '" . (int)$customer_id . "'"); $cInfo = new objectInfo($customer_info->fields); } } // error detection if ($action == 'get_customet') { if (!isset($_POST['customers_lastname']) ) { $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> <script language="javascript" src="includes/menu.js"></script> <script language="javascript" src="includes/general.js"></script> <script language="javascript" type="text/javascript"> <!-- var form = ""; var submitted = false; var error = false; var error_message = ""; function check_form(form_name) { if (submitted == true) { alert("<?php echo JS_ERROR_SUBMITTED; ?>"); return false; } error = false; form = form_name; error_message = "<?php echo JS_ERROR; ?>"; check_select("customers_lastname", "", "<?php echo ERROR_NO_CUSTOMER_SELECTED; ?>"); if (error == true) { alert(error_message); return false; } else { submitted = true; return true; } } // --> </script> </head> <body onLoad="init()"> <!-- header //--> <?php require (DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <!-- body_text //--> <td width="100%" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?> </td> <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?> </td> </tr> </table> </td> </tr> <tr> <td class="formAreaTitle"><?php echo CATEGORY_CUSTOMER; ?> </td> </tr> <tr> <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> </td> <td class="main" valign="top"><?php echo TEXT_SELECT_CUSTOMER . zen_draw_form('customer_select', FILENAME_CUSTOM_ORDER, '', 'get') . ' ' . zen_draw_pull_down_menu('customers', 'onChange="this.form.submit();"') . zen_hide_session_id() . zen_draw_hidden_field('action', 'get_customer'); $customer_info = $db->Execute(zen_db_input($_POST['customers_lastname']), TABLE_CUSTOMERS) . '</form>'; ?> </td> <td class="main"> TODO: Display customer details here. </td> </tr> </table> </td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br /> </body> </html> <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Goshawk



