I need to complete mysql_query SELECT multiple options and publish results on webpage. The form (Breezingforms) pulls data.
Joomla module to appear on webpage
<div id="frmSrchResults"></div>
"Search" button on the form with user choices to pull data from db
function ff_Searchbutton_action(element, action)
{
switch (action) {
case 'click':
let var1 = ff_getElementByName('category').value;
let var2 = ff_getElementByName('subcategory').value;
let var3 = ff_getElementByName('CselCountry').value;
// call the .post
jQuery.ajaxSetup({async:false});
jQuery.post(
'<?php return JUri::root(true); ?>/index.php', {
option: 'com_breezingforms',
ff_form: ff_processor.form,
format: 'html',
category: var1,
subcategory: var2,
country: var3
},
// success: function(data) {
function(data) {
jQuery('#frmSrchResults').html(data);
);
break;
default:;
} // switch
} // ff_Searchbutton_action
In Form Pieces-Before Form
$this->execPieceByName('ff_InitLib');
// fetch .post() parameters
$var1 = JRequest::getVar('par1');
$var2 = JRequest::getVar('par2');
if ($var1 && $var2 && $var1 !== '' && $var2 !== '') {
$db = JFactory::getDBO();
$db->setQuery("Query I need to complete");
$result = $db->loadAssocList();
// clean output buffer
while (@ob_get_level() > 0) { @ob_end_clean(); }
echo $result;
exit;
}
This is an example of the database structure
id title name value
4 Company Name companyname Microsoft
4 Company Address companyaddress someaddress
4 Country country USA
4 Category category Computer
4 Sub-category subcategory Software
5 Company Name companyname Apple
5 Company Address companyaddress someaddress2
5 Country country CANADA
5 Category category Business
5 Sub-category subcategory Executive
6 Company Name companyname Ollivetti
6 Company Address companyaddress someaddress3
6 Country country CANADA
6 Category category Business
6 Sub-category subcategory Executive
e.g. User input in the form:
Category=Business
Sub-category=Executive
Country=CANADA
Now I need to: SELECT value (according to user choice on the form. Each form element is a select list) FROM table etc. So in my example the result is expected to be something like this:
Company Name Company Address
Apple someaddress2
Ollivetti someaddress3