Hi Debbie - still at a complete loss over this. Therefore, please find below:
1) The php code to display the search form (I have reverted to ('text','textarea','rich_editor') for the WHERE clause):
[pre]
<?php
if ($_GET["function"] != "show_search_form") { //this if statement prevents the Quick Search form to show up on the Advanced Search page
?>
<?php
// query to get the fields names to include in the search - specify which types in the where clause
// remove the where part of the sql line if you want to include ALL your fields
$sqlcols = "SELECT name_field FROM ".$prefix_internal_table.$table_name." WHERE type_field IN
('text','textarea','rich_editor')";
//This line searches only specific fields in the database that are specified by the field name. To use it Uncomment it and comment the line above. Change the fields names to the names in your database.
//$sqlcols = "SELECT name_field FROM ".$prefix_internal_table.$table_name." WHERE name_field IN ('venue_town','firstname','surname,'telephone','venue_postcode','county')";
//This line searches all fields.
//$sqlcols = "SELECT name_field FROM ".$prefix_internal_table.$table_name."";
$searchall = execute_db($sqlcols, $conn);
// as long as column names are found meeting criteria above, construct form fields
while ($searchfield = fetch_row_db($searchall)){
// This line not required -- used to get list of column names into array that can be printed to screen to verify columns it has found
$allfields .= $searchfield[0].' ';
// sets the search select type to 'contains' for each column included in search request
$allseltypes .= '<input name="'.$searchfield[0].$select_type_select_suffix.'" type="hidden" value="contains">';
// creates a hidden form field for each column included in search request
$fieldterm .= '<input name="'.$searchfield[0].'" type="hidden" value="">';
// writes onSubmit values to form open tag to set the value for each hidden field defined above
$submitline .= 'document.searchall.'.$searchfield[0].'.value = document.searchall.allterm.value;';
} // end while column names are found
// uncomment to display database table columns found which will be included in search form
echo '<pre>';
print_r($allfields);
echo '</pre>';
?>
<form style="color:#fff; font-size:12px; padding-bottom:5px;" name="searchall" class="noformpad" method="post" action="<?php echo $dadabik_main_file; ?>?table_name=<?php echo urlencode($table_name); ?>&page=0&function=search&execute_search=1" enctype="multipart/form-data" accept-charset="Windows-1255" onsubmit="javascript:<?php echo $submitline; ?>return true;">
Quick Name or Tel No. Search:
<input type="hidden" name="operator" value="or"/>
<?php echo $allseltypes; ?>
<input name="allterm" type="text" size="20" maxlength="100"/>
<?php echo $fieldterm; ?>
<input type="submit" value="<?php echo $submit_buttons_ar["search_short"]; ?>" class="submit"/>
</form>
<?php
} //closing bracket for the if ($_GET["function"] != "show_search_form")
?>
[/pre]
2) The HTML of resulting search form:
[pre]
<pre>ID _sfm_form_submision_time_ _sfm_visitor_ip_ firstname surname telephone email venue_name venue_address venue_address2 venue_town venue_postcode venue_telephone notes total_price booking_fee act_name balance voucher_code recip_name </pre>
<form style="color:#fff; font-size:12px; padding-bottom:5px;" name="searchall" class="noformpad" method="post" action="index.php?table_name=customer_booking_form&page=0&function=search&execute_search=1" enctype="multipart/form-data" accept-charset="Windows-1255" onsubmit="javascript:document.searchall.ID.value = document.searchall.allterm.value;document.searchall._sfm_form_submision_time_.value = document.searchall.allterm.value;document.searchall._sfm_visitor_ip_.value = document.searchall.allterm.value;document.searchall.firstname.value = document.searchall.allterm.value;document.searchall.surname.value = document.searchall.allterm.value;document.searchall.telephone.value = document.searchall.allterm.value;document.searchall.email.value = document.searchall.allterm.value;document.searchall.venue_name.value = document.searchall.allterm.value;document.searchall.venue_address.value = document.searchall.allterm.value;document.searchall.venue_address2.value = document.searchall.allterm.value;document.searchall.venue_town.value = document.searchall.allterm.value;document.searchall.venue_postcode.value = document.searchall.allterm.value;document.searchall.venue_telephone.value = document.searchall.allterm.value;document.searchall.notes.value = document.searchall.allterm.value;document.searchall.total_price.value = document.searchall.allterm.value;document.searchall.booking_fee.value = document.searchall.allterm.value;document.searchall.act_name.value = document.searchall.allterm.value;document.searchall.balance.value = document.searchall.allterm.value;document.searchall.voucher_code.value = document.searchall.allterm.value;document.searchall.recip_name.value = document.searchall.allterm.value;return true;">
Quick Name or Tel No. Search:
<input type="hidden" name="operator" value="or"/>
<input name="ID__select_type" type="hidden" value="contains"><input name="_sfm_form_submision_time___select_type" type="hidden" value="contains"><input name="_sfm_visitor_ip___select_type" type="hidden" value="contains"><input name="firstname__select_type" type="hidden" value="contains"><input name="surname__select_type" type="hidden" value="contains"><input name="telephone__select_type" type="hidden" value="contains"><input name="email__select_type" type="hidden" value="contains"><input name="venue_name__select_type" type="hidden" value="contains"><input name="venue_address__select_type" type="hidden" value="contains"><input name="venue_address2__select_type" type="hidden" value="contains"><input name="venue_town__select_type" type="hidden" value="contains"><input name="venue_postcode__select_type" type="hidden" value="contains"><input name="venue_telephone__select_type" type="hidden" value="contains"><input name="notes__select_type" type="hidden" value="contains"><input name="total_price__select_type" type="hidden" value="contains"><input name="booking_fee__select_type" type="hidden" value="contains"><input name="act_name__select_type" type="hidden" value="contains"><input name="balance__select_type" type="hidden" value="contains"><input name="voucher_code__select_type" type="hidden" value="contains"><input name="recip_name__select_type" type="hidden" value="contains"><input name="allterm" type="text" size="20" maxlength="100"/>
<input name="ID" type="hidden" value=""><input name="_sfm_form_submision_time_" type="hidden" value=""><input name="_sfm_visitor_ip_" type="hidden" value=""><input name="firstname" type="hidden" value=""><input name="surname" type="hidden" value=""><input name="telephone" type="hidden" value=""><input name="email" type="hidden" value=""><input name="venue_name" type="hidden" value=""><input name="venue_address" type="hidden" value=""><input name="venue_address2" type="hidden" value=""><input name="venue_town" type="hidden" value=""><input name="venue_postcode" type="hidden" value=""><input name="venue_telephone" type="hidden" value=""><input name="notes" type="hidden" value=""><input name="total_price" type="hidden" value=""><input name="booking_fee" type="hidden" value=""><input name="act_name" type="hidden" value=""><input name="balance" type="hidden" value=""><input name="voucher_code" type="hidden" value=""><input name="recip_name" type="hidden" value=""><input type="submit" value="Search" class="submit"/>
</form>
[/pre]
3) But with only the fieldnames I care about being included (the fields in bold are NOT currently being searched by the query, so if I could just get these 3 included, I'd be happy!):
firstname, surname, venue_town, venue_county, telephone, email, notes.
And this is the result from the SQL query:
Your SQL query (for debugging purpose): SELECT `customer_booking_form`.`Date_Of_Event`, `customer_booking_form`.`venue_town`, `customer_booking_form`.`hr`, `customer_booking_form`.`mn`, `customer_booking_form`.`ampm`, `customer_booking_form`.`ID`, `customer_booking_form`.`firstname`, `customer_booking_form`.`surname`, `customer_booking_form`.`telephone`, `customer_booking_form`.`email`, `customer_booking_form`.`service_required`, `customer_booking_form`.`occasion`, `customer_booking_form`.`recip_name`, `customer_booking_form`.`venue_name`, `customer_booking_form`.`venue_address`, `customer_booking_form`.`venue_address2`, `customer_booking_form`.`venue_county`, `customer_booking_form`.`venue_postcode`, `customer_booking_form`.`venue_telephone`, `customer_booking_form`.`costume_required`, `customer_booking_form`.`act_name`, `customer_booking_form`.`notes`, `customer_booking_form`.`terms_conditions`, `customer_booking_form`.`total_price`, `customer_booking_form`.`booking_fee`, `customer_booking_form`.`balance`, `customer_booking_form`.`payment_type`, `customer_booking_form`.`voucher_code`, `customer_booking_form`.`status`, `customer_booking_form`.`_sfm_form_submision_date_`, `customer_booking_form`.`_sfm_visitor_ip_`, `customer_booking_form`.`user_ID`, `customer_booking_form`.`contact_type`, `customer_booking_form`.`details_sent`, `artiste_contacts__1`.`Stage_Name` AS `artiste_contacts__Stage_Name__1`, `customer_booking_form`.`act_gender`, `customer_booking_form`.`completed` FROM `customer_booking_form` LEFT JOIN `artiste_contacts` AS `artiste_contacts__1` ON `customer_booking_form`.`act_sent` = `artiste_contacts__1`.`act_ID` WHERE `customer_booking_form`.`firstname` LIKE '%london%' or `customer_booking_form`.`surname` LIKE '%london%' or `customer_booking_form`.`telephone` LIKE '%london%' or `customer_booking_form`.`email` LIKE '%london%'
It appears to be setting up the search form OK and its only the where clause of the sql statement that isn't including all the fields, and only searching in 4 of them.
Thanks Debbie.