Frederic
|
| Posted: 06/27/2002, 10:53 PM |
|
I use cc to build a staff directory with php4 templates and mysql
see my testing site here http://www.educ.dab.uts.edu.au/webmaster/staff/Default.php
I have in my database various checkboxes: some staff are technical, multilingual, executive, ....
In the EmpsRecord.php, when clicking on the checkbox put a 1 in the database. I have one column for each of the checkboxes.
I can't get the search working on checkboxes.
I get http://www.educ.dab.uts.edu.au/webmaster/staff/Default....e=&technical=on
... if I select technical in this example.
What I don't undestand is if I put manually Default.php?FormName=Search&FormAction=search&name=&technical=1
I get all the records in the database, not the only technical people in the database
I don't understand
Thanks for your help
|
|
|
 |
Chris K.
|
| Posted: 06/28/2002, 4:01 PM |
|
I think the easiest solution to make it work would be to grid Open event that would check if checkbox has been checked (get_param("technical")=="On") and append filtering expression to $sWhere variable. Similar way with other checkboxes.
|
|
|
 |
frederic
|
| Posted: 06/30/2002, 4:44 PM |
|
sorry
I am very new to cc and quite new to php..
How do you do with, is it in cc or hard coding the php default.php code
If it is in cc, in the form property, open event window, what do you write exactly there?
thanks
Frederic
I think the easiest solution to make it work would be to grid Open event that would check if checkbox has been checked (get_param("technical")=="On") and append filtering expression to $sWhere variable. Similar way with other checkboxes.
|
|
|
 |
Chris K.
|
| Posted: 07/01/2002, 12:07 AM |
|
You should write Open for your grid. Put this code there:
if (get_param("technical"))
{
if (!$sWhere)
$sWhere = " WHERE ";
else
$sWhere = " AND ";
$sWhere .= "technical=1";
}
if (get_param("professor"))
{
if (!$sWhere)
$sWhere = " WHERE ";
else
$sWhere = " AND ";
$sWhere .= "professor=1";
}
and similarly with other checkboxes
Good luck
|
|
|
 |
|