How to have search by sex with both options

Hi All,

I am having Sex fields as "male/female" in join form, but I need to have Search form sex fields as "male/ female/both" .

My search is based on looking for search, So I am search by male, is getting result and if search by female is getting result. Actually I need as search by "both" means man and woman result have to display. 

Thanks in Advance.

Quote · 27 Feb 2015

It is not built into Dolphin but this module in the market will allow you to change the field on the search form.

http://www.boonex.com/m/advanced-search-form

Geeks, making the world a better place
Quote · 27 Feb 2015

Hi geek_girl,

Thanks for reply. And I tried in search.php

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' || $aRequestParams['Sex'] = 'male';
}

another try is

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' ? 'female' : 'male';
}

and another try is

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' || 'male';
}

But I am getting output for female alone not for male .

How do I write condition for searching for both sex if it is female or male.

Quote · 30 Mar 2015

 

Hi geek_girl,

Thanks for reply. And I tried in search.php

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' || $aRequestParams['Sex'] = 'male';
}

another try is

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' ? 'female' : 'male';
}

and another try is

if($aRequestParams['Sex'] == 'both'){
   
    $aRequestParams['Sex'] = 'female' || 'male';
}

But I am getting output for female alone not for male .

How do I write condition for searching for both sex if it is female or male.

The query does an AND on the fields; the module I posted will allow you to set up a search form where the user can check male and female boxes and then the search should return both male and female. 

However, think about what you have coded; walk through the code saying it out loud.

$aRequestParams['Sex'] = 'female' || $aRequestParams['Sex'] = 'male'

This is saying set the value in the array to female or set the value to male.  It does not make any sense here.


$aRequestParams['Sex'] = 'female' ? 'female' : 'male';

This is a shorten form of an if:else statement.

 

I am guessing that you want a selection in sex in the search for "Both".  and you want to rewrite the search so that both does an AND on "male" and "female"  I still say the module I listed is the easiest and best way to go about building better search forms in Dolphin.

Geeks, making the world a better place
Quote · 30 Mar 2015
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.