problem with multisearch

12 posts by 4 authors in: Forums > CMS Builder
Last Post: February 23, 2011   (RSS)

By hordak - February 23, 2011

Hey Jason,

Thanks for the advice. I'm currently working between both the Basic Search Code and Multi-search code as supplied. I'm having a problem with the output, because my searchDetails Variable is not resolving (line 48).

Also, My search form is posting all records without a keyword.

- Multisearch doesn't supply necessary fields
see http://www.centralstate.edu/services/contact/_includes/multiSearch.php (try keywords Dean and then giraffe)

- My simple search is kicking back the errors as specified
see http://www.centralstate.edu/services/contact/_includes/search-self.php (try keywords Dean and then giraffe)

What should I do?

<?php

require_once "/home/cmsAdmin/lib/viewer_functions.php";

$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "10";
$searchOptions['debugSql'] = "1";


list($sv_campus_directoryRecords, $sv_campus_directoryMetaData) = getRecords(array(
'tableName' => 'sv_campus_directory',
'perPage' => '3',
));


?>
<!-- /STEP1: Load Record List -->

<div class="container">
<div class="top"><strong><span class="text_maroon">Search CSU Departments</span></strong></div>

<div class="OneColumn">
<form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<!--<form method="POST" action="search.php?department_keyword">-->
<input type="text" name="q" value="<?php echo htmlspecialchars(@$FORM['q']); ?>">
<input type="submit" name="" value="Search">

</form>

<?php if ($sv_campus_directoryRecords): ?>
<table border=0 cellpadding=2 cellspacing=0 width=100%>
<tr>
<td bgcolor="#EEEEEE"><span class="text">Search results for <strong><?php echo htmlspecialchars(@$FORM['q']); ?></strong></span></td>
<td bgcolor="#EEEEEE" align="right"><span class="text">Results
<b><?php echo htmlspecialchars($sv_campus_directoryMetaData['pageResultsStart']); ?></b> to
<b><?php echo htmlspecialchars($sv_campus_directoryMetaData['pageResultsEnd']); ?></b> of
<b><?php echo htmlspecialchars($sv_campus_directoryMetaData['totalRecords']); ?></b>.</span></td>
</tr>
</table>

<br clear="all" />

<!-- show errors -->
<?php if ($sv_campus_directoryMetaData['invalidPageNum']): ?>
<span class="text">Results page '<?php echo $searchDetails['page']?>' not found, <a href="<?php echo $searchDetails['firstPageLink'] ?>">start over &gt;&gt;</a>.</span><br/>
<?php elseif ($searchOptions['keywords'] && $searchDetails['noRecordsFound']): ?>
<span class="text">No records matched search query!</span><br/>
<?php elseif ($searchOptions['keywords'] == ""): ?>
<span class="text">Enter a keyword to search.</span><br/>
<?php endif ?>
<!-- show errors -->
<br>


<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<?php foreach ($sv_campus_directoryRecords as $record): ?>
<span class="text">
<strong><?php echo $record['department'] ?></strong>
<?php if ($record['url']): ?>
| <a href="<?php echo $record['url'] ?>" target="_blank">Visit Website</a>
<?php endif ?>
<br/>
Phone: <?php echo $record['phone'] ?><br/>
Fax: <?php echo $record['fax'] ?><br/>
Email: <?php echo $record['email'] ?><br/>
</span>
<hr size="1"/>
<?php endforeach ?>
<!-- /STEP2: Display Records -->

<!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
<?php if ($sv_campus_directoryMetaData['prevPage']): ?>
<span class="text"><a href="<?php echo $sv_campus_directoryMetaData['prevPageLink'] ?>">.:. prev</a></span>
<?php else: ?>
<span class="text" style="color:#999;">.:. prev</span>
<?php endif ?>

<span class="text">- page <?php echo $sv_campus_directoryMetaData['page'] ?> of <?php echo $sv_campus_directoryMetaData['totalPages'] ?> -</span>

<?php if ($sv_campus_directoryMetaData['nextPage']): ?>
<span class="text"><a href="<?php echo $sv_campus_directoryMetaData['nextPageLink'] ?>">next .:.</a>
<?php else: ?>
<span class="text" style="color:#999;">next .:.</span>
<?php endif ?>
<!-- /STEP3: Display Page Links -->

<?php endif ?>

<?php if (!$sv_campus_directoryRecords): ?>
&nbsp;
<?php endif ?>
</div>
</div>