This topic is locked
[SOLVED]

 dropdown list to filter list page

8/11/2020 1:51:25 PM
PHPRunner General questions
woodey2002 author

Hi Guys,
Trying to expand on the cool item I found in the runner manual.
https://xlinesoft.com/phprunner/docs/add_a_dropdown_list_box_with_specific_values.htm



$str= "<select style='width: 200px; display: inline-block;' class='form-control' onchange=\"window.location.href=this.options[this.".

"selectedIndex].value;\"><option value=\"\">Filter jobs </option>";

//select values from the database

$strSQL = "select status from jobs";

$rs = db_query($strSQL);

while ($data = db_fetch_array($rs))

$str.="<option value='jobs_list.php?q=(status~equals~".

$data["status"].")'>".$data["status"]."</option>";

$str.="</select>";

echo $str;


Via a phpsnippet it creates a nice little drowdown on a list page and then filters the list page based on the user selection.
For example I have field called "Status" which has two options for users to select from which are "open" and "closed"
Now the code above works great for both "open" and "closed" options however I wonder if there is a way to add an option to allow users to show all after making and initial filter i.e. remove the filter and show all records both open and closed.
Any ideas much appreciated!
Thanks,

J

woodey2002 author 8/11/2020

This functionality is already built-in and can be achieved via changing "search and filter settings" on the Misc tab of runner.
Perfect!!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=92261&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />