Forums

Show Only a particular result from a dropdown list

geeknet 12 Aug, 2009
Hi Im a newbie here,

I made a form with a dropdown list and I wanted to show a particular result in just one page

here for example:

in the dropdown list

Agriculture
Management
Business
Marketing

if a user selected Agriculture.

a page will show only results with Agriculture and same with the other list with their own results.

thanks
GreyHead 12 Aug, 2009
Hi geeknet,

The basic methodology is to create a form in the Header section - then use the results of the form to build a MySQL WHERE query in the Where box. In this case the Where might be just
<?php
$area = JRequest::getString('area', 'some_default_value', 'post);
echo " WHERE `area` = '$area' ";
?>

Bob
geeknet 13 Aug, 2009
Thanks Bob,

so which parameters do I need to change

the name of the downdown list is select_13

and the selection is Agriculture

roy
GreyHead 13 Aug, 2009
Hi Roy,

The WHERE code would look like:
<?php
$area = JRequest::getString('select_13', 'some_default_value', 'post);
echo " WHERE `column_name` = '$area' ";
?>

Bob
This topic is locked and no more replies can be posted.