I have a dropdown list that populate from Joomla database
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
// Get a db connection.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('peak_name');
$query->from($db->qn('#__unclimbedpeaks'));
$query->where($db->quoteName('#__unclimbedpeaks.link_id')." = ".$db->quote($link_id));
$query->order('peak_id ASC');
$db->setQuery($query);
$peaks_list = $db->loadColumn();
$peaks_select = '<select name="name" id="peaks">';
$peaks_select .= '<option value="">-- Odaberi vrh --</option>';
// here we use the peak_name for the value, whereas usually you set the value to the id of the table row. we're assuming there won't be any double quotes in these names.
foreach($peaks_list as $p){
$peaks_select .= '<option value="' . $p . '">' . $p . '</option>';
}
$peaks_select .= '</select>';
?>
<form name="lista" method="post" action="">
<?php echo $peaks_select; ?>
</form>
Is it possible to get the $result variable without using the submit button.
So, when a user selects a value from the dropdown list, that is $result = "selected value" without clicking on submit
Thanks in advance