$form->data("userinputfindabook"));if(dropDownOption === 1)return array("book title" => $form->data("userinputfindabook"));if(dropDownOption === 2)return array("ISBN" => $form->data("userinputfindabook"));?>The problem is I don't know how to write the condition of the if statement."> if statement based on state of drop down menu? - Forums

Forums

if statement based on state of drop down menu?

FreeSandwiches 02 Nov, 2014
Hey there. I'm a bit of a noob so I apologize if this is an obvious question. I am trying to query a database based on the chose from a drop down menu in the same form so it looks like this.

<?php

if(dropDownOption === 0)
return array("Author" => $form->data("userinputfindabook"));

if(dropDownOption === 1)
return array("book title" => $form->data("userinputfindabook"));

if(dropDownOption === 2)
return array("ISBN" => $form->data("userinputfindabook"));

?>

The problem is I don't know how to write the condition of the if statement.
Max_admin 03 Nov, 2014
Answer
Hi,

It should be like this:

<?php
if($form->data("dropdown_field_name") == 0){
return ...
}else if($form->data("dropdown_field_name") == 1){
return ...
}else if($form->data("dropdown_field_name") == 2){
return ...
}


Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.