Hi Guys/ Girls,
PHP is not my strong suit but am plodding along… am really stuck on this one and am not sure it is even possible.
I have a form that displays customer records (first name, last name, address, tel numbers, email etc). I have a basic filter set up using POST data. I have one input field for each table row (i.e first name, last name). So if i enter Andy in the first name field and submit the data is filtered and only fist names that are like andy are displayed.
I want to change this so I only have one filter box that searches the entire record. So if I typed andy it would show results where andy apears in the first name, last name, address etc.
Is this possible?
Here is the code I currently have, any hel would be great!
[php]$cust_query = "SELECT * FROM customers
c LEFT JOIN address_book
a ON a.address_book_id
= c.customers_default_address_id
WHERE c.customers_firstname
LIKE ‘%$_POST[firstname]%’
AND c.customers_lastname
LIKE ‘%$_POST[lastname]%’
AND a.entry_postcode
LIKE ‘%$_POST[postcode]%’
AND c.customers_email_address
LIKE ‘%$_POST[email]%’
LIMIT 500
";
$cust = $db->Execute($cust_query);
$custArray = array();
while (!$cust->EOF) {
$custArray[] = array(‘customers_firstname’=>$cust->fields[‘customers_firstname’],
‘customers_lastname’=>$cust->fields[‘customers_lastname’],
‘entry_company’=>$cust->fields[‘entry_company’],
‘entry_street_address’=>$cust->fields[‘entry_street_address’],
‘entry_suburb’=>$cust->fields[‘entry_suburb’],
‘entry_city’=>$cust->fields[‘entry_city’],
‘entry_state’=>$cust->fields[‘entry_state’],
‘entry_postcode’=>$cust->fields[‘entry_postcode’],
‘entry_firstname’=>$cust->fields[‘entry_firstname’],
‘entry_lastname’=>$cust->fields[‘entry_lastname’],
‘customers_telephone’=>$cust->fields[‘customers_telephone’],
‘customers_fax’=>$cust->fields[‘customers_fax’],
‘customers_mobile’=>$cust->fields[‘customers_mobile’],
‘customers_other’=>$cust->fields[‘customers_other’],
‘customers_email_address’=>$cust->fields[‘customers_email_address’],
‘customers_id’=>$cust->fields[‘customers_id’],
);
$cust->MoveNext();
}
Account | Customer Details |
---|---|
<?php echo '' . $cust['customers_id'] . ''; ?> | <?php echo $cust['customers_firstname']; ?> <?php echo $cust['customers_lastname']; ?> <?php echo $cust['entry_company']; ?> - <?php echo $cust['entry_street_address']; ?> <?php echo $cust['entry_suburb']; ?> <?php echo $cust['entry_city']; ?> <?php echo $cust['entry_state']; ?> <?php echo $cust['entry_postcode']; ?> |