Hello all,
I have made a basic search form that contains textboxes and drop down menus. Now I would like to have a checkbox. This checkbox can be checked if you only want to see the results that contains a URL of a photo. Not every row in my database has a URL of a photo, so when this box is checked, It has to see if the row contains an image.
How can this be done?
I have made a basic search form that contains textboxes and drop down menus. Now I would like to have a checkbox. This checkbox can be checked if you only want to see the results that contains a URL of a photo. Not every row in my database has a URL of a photo, so when this box is checked, It has to see if the row contains an image.
How can this be done?
Thank you for your fast reply.
But how can I put this in my where code?
This is my code:
In my form, I have to add a checkbox code?
But how can I put this in my where code?
This is my code:
<?php
$search_array = array('reg', 'aircraft', 'fotograaf', 'year', 'month', 'owner2', 'type', 'section');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '%$value%' ";
}
}
if ( !empty($where) ) {
echo " WHERE ".explode(' AND ', $where);
}?>
In my form, I have to add a checkbox code?
Hi flyboeing,
Yes you'd need to add a checkbox.
Bob
Yes you'd need to add a checkbox.
<?php
$search_array = array('reg', 'aircraft', 'fotograaf', 'year', 'month', 'owner2', 'type', 'section');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '%$value%' ";
}
}
$images = JRequest::getString('images_only', '', 'post');
if ( $images ) {
$where[] = "`url` != '' ";
}
if ( !empty($where) ) {
echo " WHERE ".explode(' AND ', $where);
}?>
Bob
This topic is locked and no more replies can be posted.