Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Multiple option 20.09.2014 12:24

I am having problems with the output of multiple option.
This is my code

if($question2=="option1"){
$message2="option1";

}

if($question2=="option2"){
$message2="option2";

}

else {
$message2="message2";

}

I have 3 multiple option.
If user chooses option1 only then output should be "option1"
If user chooses option2 only then output should be "option2"
If user chooses option1 and option2 then output should be "option1 option2"
if not then "message2" I cannot make this work

I also need that output"option1" has a href link. ie href=www.sample.com


Thanks a bundle

Edited by moon_1800 - 20.09.2014 13:32

Re: Multiple option 21.09.2014 19:44

Hi,
when you use a multiple option field, the result you receive comes in form of a list of options checked. You have a php function able to find out if a value is present at that result. Assuming your field is named 'question2', and you have the optional values 'option1', 'option2', and 'option3', you can use.

$message="Default message in case none of the conditions below is met.";

if(in_array("option1",$question2)){

$message="This means option1 was selected";

}

if(in_array("option3",$question2)){

$message="This means option3 was selected";

}

if(in_array("option1",$question2)&&in_array("option2",$question2)){

$message="This means option1 AND option2 were selected";

}



etc.

you can output any html inside the result, something like

$message="[a href='www.moonsoft.es']LINK[/a]";

(replace the [ ] signs for the proper tags, the forum strips the less than lower than chars)

will print a link to our site at the output.

Hope this helps, regards

Edited by MSTeam - 21.09.2014 19:45
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Our clients' feedback