BASIC SEARCH FOR A KEYWORD IN MULTIPLE FIELDS IN A MULTI-RECORD EDITOR - Oct 2nd, 2022


At the top of your page:


<?php
// load records from 'your_table'
list($your_tableRecords, $your_tableMetaData) = getRecords(array(
'tableName' => 'your_table',
'loadUploads' => true,
'allowSearch' => true,
'where' => " field1 LIKE '%".mysql_escape($query)."%' OR field2 LIKE '%".mysql_escape($query)."%' OR field3 LIKE
'%".mysql_escape($query)."%' " // Add as many fields as you need above, separating each by an OR
));

$query = @$_REQUEST['query']; // this will hold the keyword
?>

And in the Body

<form action="search.php" method="post">
<input type="text" name="query">
<input type="submit" name="submit" value="Search">
</form>

You might also want to include a cancel search form:

<form method="post" action="" >
<INPUT TYPE="submit" VALUE="Cancel Search - Start a New Search">
</form>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service