Checkbox Issue

10 posts by 3 authors in: Forums > CMS Builder
Last Post: August 25, 2011   (RSS)

I am trying to limit the search of my online documents to those written in teh French language. Can anyone tell me the best way to do this? Here is my code:

The checkbox is labelled "french_qsp" and is part of the table "dms_home_page".



Basically, all I wan to do is filter out all non-french documents during a search.



Thanx!



Ragi

<?php header('Content-type: text/html; charset=ISO-8859-1'); ?>
<?php
require_once "nptadmin/lib/viewer_functions.php"; list($dms_home_pageRecords, $dms_home_pageMetaData) = getRecords(array(
'tableName' => 'dms_home_page',
'loadUploads' => '0',
));



list($ccaRecords, $ccaMetaData) = getRecords(array(
'tableName' => 'cca',
'orderBy' => 'title asc',
'loadUploads' => '0',
'allowSearch' => '0',
));



list($mosRecords, $mosMetaData) = getRecords(array(
'tableName' => 'mos',
'loadUploads' => '0',
'orderBy' => 'title asc',
'allowSearch' => '0',
));



list($competencyRecords, $competencyMetaData) = getRecords(array(
'tableName' => 'competency',
'loadUploads' => '0',
'allowSearch' => '0',
));



list($mite_course_idRecords, $mite_course_idMetaData) = getRecords(array(
'tableName' => 'mite_course_id',
'loadUploads' => '0',
'allowSearch' => '0',
));



list($qualification_levelRecords, $qualification_levelMetaData) = getRecords(array(
'tableName' => 'qualification_level',
'loadUploads' => '0',
'allowSearch' => '0',
));



list($developmental_periodRecords, $developmental_periodMetaData) = getRecords(array(
'tableName' => 'developmental_period',
'loadUploads' => '0',
'allowSearch' => '0',
));



list($popupsRecords, $popupsMetaData) = getRecords(array(
'tableName' => 'popups',
'loadUploads' => '0',
'allowSearch' => '0',
));



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<title>Entrepôt PNQ</title>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<style type="text/css">
body { font-family: arial; }
.searchblock { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>




</head>
<body>




<h1>Entrepôt PNQ</h1>
<br />
<a href="http://mfs-hfx-qcms001/index.php">English</a>
<br/>
<a href="http://mfa-hfx-qcms001/nptAdmin" target="_blank">Login</a>




<br />
<div class="searchblock">
<p><b>Instructions</b>: Vous pouvez faire votre recherche en utilisant l'un des critères de recherche ci-dessous. Si vous utilisez plus d'un critère, vous devais être conscient du genre de recherche. Par exemple, si vous choisissez un GPM et un AMCP, la recherche affichera toutes les PNQ qui appartiennent à ce AMCP et sont pour la GPM spécifiques.
</p>
<p>Des rapports spécifiques sont disponibles sur demande. S'il vous plaît contactez
<a href="mailto:ned.robb@forces.gc.ca">Support technique DIEM</a> pour l'aide.</p>
<p>Rapports AMCP PNQ Report:
<form method="POST" action="specialResults_f.php">
<select name="cca" value="" size="1" style="width: 120px;">
<option value="" Sélectionner un rapport du AMCP</option>



<?php foreach ($ccaRecords as $record): ?>

<option value="<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach; ?>




</select>
<input type="submit" name="submit" value="Search">
<input type="reset" value="Reset">
</form>
</div>
</br />
<div class="searchblock">
<table cellpadding="10">
<tr>
<td colspan="8">
<b>Recherche par mot clé dans le titre du cours</b>
</td>
</tr>
<tr>
<form method="POST" action="searchResults_f.php">
<td colspan="8"><input type="text" name="title_keyword" value="" size="60"><br /></td>
</tr>
<tr>
<td align="center"><b>Code de cours:</b></td>
<td align="center"><b>Compétences:</b></td>
<td align="center"><b>GPM:</b></td>
<td align="center"><b>AMCP:</b></td>
<td align="center"><b>Niveau de qualification:</b></td>
<td align="center"><b>Période de perfectionnement:</b></td>
<td align="center"><b>Archive:</b></td>
</tr>
<tr>
<td><input type="text" name="course_id_match" value="" size="14"></td>
<td><input type="text" name="competency_match" value="" size="14"></td>
<td>
<select name="mos_id" value="" size="1" style="width: 120px;">
<option value="" Sélectionnez un GPM</option>
<?php foreach ($mosRecords as $record): ?>
<option value="<?php echo $record['mos_id'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<select name="cca" value="" size="1" style="width: 120px;">
<option value="" Sélectionnez un AMCP</option>
<?php foreach ($ccaRecords as $record): ?>
<option value="<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<select name="ql" value="" size="1" style="width: 120px;">
<option value="" Sélectionnez un NQ</option>
<?php foreach ($qualification_levelRecords as $record): ?>
<option value="<?php echo $record['ql'] ?>"><?php echo $record['ql'] ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<select name="dp" value="" size="1" style="width: 120px;">
<option value="" Sélectionnez une PP</option>
<?php foreach ($developmental_periodRecords as $record): ?>
<option value="<?php echo $record['dp'] ?>"><?php echo $record['dp'] ?></option>
<?php endforeach; ?>
</select>
</td>
<td align="center">
<input type="checkbox" name="archive_match" value="">
</td>
</tr>
<tr colspan="8">
<td><input type="submit" name="submit" value="Search">
<input type="reset" value="Reset">
</form></td>
</tr>
</table>



<br />

</div>





</body>
</html>

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Checkbox Issue

By gkornbluth - August 18, 2011 - edited: August 18, 2011

Hi Ragi,

Didn't get to look too closely, but I assume that you've already tried variations on things like:

'where' => "french_qsp = '0' ",
and
<?PHP foreach ($dms_home_pageRecords as $record ): ?>
<?PHP if ($record['french_qsp'] == 1): ?>

Rest of your code...

<?php endforeach; ?>

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [northernpenguin] Checkbox Issue

Actually, I don't see you using dms_home_page anywhere in your code except for the list records call, so I'm not sure how to do what you are trying to do.

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [northernpenguin] Checkbox Issue

By Jason - August 18, 2011

Hi Ragi,

Is the code you're posting from specialResults_f.php or is this just the search form? Could you post the .php page where you want to display your results? Also, which section are your documents stored in?

Let me know and we'll try to make some suggestions.

Thanks-
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Checkbox Issue

Unfortunately, I can't get to the files until tomorrow. However, the code I posted above is from index_f.php (search form). specialResults_f. Php is the output. The documents are stored in dms_home_page.
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Checkbox Issue

By Jason - August 18, 2011

Hi Ragi,

If specialResults_f.php is where we're actually performing the search and producing the output, this is where the change would have to take place.

On that page, you could try the code suggested by Jerry:

'where' => "french_qsp = '1' ",

You'll want to use the number 1, since this is the value of the field when the check box is checked.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Checkbox Issue

Thanx Jason. I will give it a try tomorrow.
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [Jason] Checkbox Issue

By northernpenguin - August 22, 2011 - edited: August 22, 2011

Jason: worked great! Now, one more question. How do I include two 'where' statements on the same page?

"french_qsp = '1'" and "archive = '0'"
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Checkbox Issue

Hi Ragi,

Have you tried:

'where' => "french_qsp = '1' AND archive = '0' ",

(saw something like that in another post)

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php