Submit form to itself to show Search Results?

gdpodesta 20 Apr, 2011
The downside of having sooooo many options and configurations, is figuring out how to do some of the simplest things, lol.

🤨 I've got a form that displays a set of records, but want to allow the user to refine the results by supplying keywords, then submit the form, and re-display the same form (just with the filter applied).

Seems straightforward enough, but can't find anything to make it work :?
GreyHead 20 Apr, 2011
Hi gdpodesta,

That sounds like a ChronoConnectivity application.

Bob
gdpodesta 20 Apr, 2011
Hmmm...looks like killing a fly with a sledgehammer, lol.

I've got a great deal of other things happening on the form as well, and really only need a resubmit with a different query string - is there no other way aside from Chrono Connectivity?
GreyHead 21 Apr, 2011
Hi gpodesta,

Or, in this case, more like killing a fly with a flyswat.

You can capture the form results from the $_POST array using the Joomla! code:
<?php
$filter = JRequest::getString

The add this to the MySQL query you are using
$db =& JFactory::getDBO();
$query = "
    SELECT `xxx`
        FROM `#__yyy`
        WHERE `filter` = '$filter' ;
";
$db->setQuery($query);
$data = $db->loadObjectList();

If you have more than one keyword you can use
WHERE `filter` IN ('filter_1', 'filter_2', 'filter_3')

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