Simple Search (maybe?)
2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 13, 2014 (RSS)
By jsammann - June 10, 2014
<form method="POST" action="/includes/cloud.php">
<input type="text" name="keywords_keyword" value="">
<input type="submit" name="submit" value="Search">
</form>
I think I'm attempting a simple search above is my search.php page
Below is my cloud.php page
All I want to do is search a field in my table called key words, the field contains multiple strings separated by commas (math 101,English Comp,Biology Lab) I would like the search to return the names of people in the respective class. What am I doing wrong?
Thanks,
James
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/localmls/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load records from 'sullivan_county'
list($sullivan_countyRecords, $sullivan_countyMetaData) = getRecords(array(
'tableName' => 'sullivan_county',
'orderBy' => 'RAND()',
'loadUploads' => false,
'allowSearch' => true,
));
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
/* mouse over link */
a:hover {
text-decoration: underline;
}
div {
text-align:justify;
}
</style>
</head>
<body>
<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<div>
<?php foreach ($sullivan_countyRecords as $record): ?>
<a href="<?php echo htmlencode($record['cloud_url']) ?>"style="color:<?php echo $record['color'] ?>;font-size:<?php echo $record['size'] ?>;background-color:<?php echo $record['bg_color'] ?>;" target="_blank"><?php echo htmlencode($record['cloud_title']) ?></a>
<?php endforeach ?>
</div>
<?php if (!$sullivan_countyRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
</body>
</html>
By claire - June 13, 2014
Hi Jsammann
Sorry for the late reply, I'm just catching up on the forum now. What's the current output when you try to do a search?
Claire Ryan
interactivetools.com
Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/