Bongiorno!Certo... eccolo qui.
HTML:
<?php
$db =& JFactory::getDBO();
$query = "
SELECT 'id', 'regione'
FROM 'regioni' ORDER BY 'regione'";
$db->setQuery($query);
$nomes = $db->loadAssocList();
$option_reg="";
foreach ( $nomes as $v ) {
$selected="";
$id = $v['id'];
$regione = $v['regione'];
if ($id==JRequest::getVar('regione',0,'GET','INT')) {
$selected="selected='selected'";
}
$option_reg.="<option value='$id' $selected>$regione</option>";
}
$query = "
SELECT 'id', 'provincia'
FROM 'province' WHERE 'id_regione'=".JRequest::getVar('regione',0,'GET','INT')." ORDER BY 'provincia'";
$db->setQuery($query);
$nomes = $db->loadAssocList();
$option_pro="";
foreach ( $nomes as $v ) {
$selected="";
$id = $v['id'];
$province = $v['provincia'];
if ($id==JRequest::getVar('provincia',0,'GET','INT')) {
$selected="selected='selected'";
}
$option_pro.="<option value='$id' $selected>$province</option>";
}
$query = "
SELECT 'id', 'comune'
FROM 'comuni' WHERE 'id_provincia'=".JRequest::getVar('provincia',0,'GET','INT')." ORDER BY 'comune'";
$db->setQuery($query);
$nomes = $db->loadAssocList();
$option_com="";
foreach ( $nomes as $v ) {
$id = $v['id'];
$comune = $v['comune'];
$option_com.="<option value='$id' $selected>$comune</option>";
}
?>
<div class="form_item">
<div class="form_element cf_dropdown">
<div style="clear:both;"><label class="cf_label">Regioni</label>
<select id="regione" name="regione" onchange="province(this.form);" class="cf_inputbox validate-selection" ><option value="" selected="selected">Seleziona</option>
<?php echo $option_reg; ?>
</select>
</div>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<div style="clear:both;"><label class="cf_label">Provincie</label>
<select id="provincia" name="provincia" onchange="reload(this.form);" class="cf_inputbox validate-selection" ><option value="" selected="selected">Seleziona</option>
<?php echo $option_pro; ?>
</select>
</div>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<div style="clear:both;"><label class="cf_label">Comuni</label>
<select id="comune" name="comune" class="cf_inputbox validate-selection" ><option value="" selected="selected">Seleziona</option>
<?php echo $option_com; ?>
</select>
</div>
</div>
<div class="cfclear"> </div>
</div>
JS:
function province(form)
{
var reg=form.regione.options[form.regione.options.selectedIndex].value;
self.location='index.php?option=com_chronocontact&prova=reg_prov_com®ione=' + reg ;
}
function reload(form)
{
var prov=form.provincia.options[form.provincia.options.selectedIndex].value;
var reg=form.regione.options[form.regione.options.selectedIndex].value;
self.location='index.php?option=com_chronocontact&prova=reg_prov_com&provincia=' + prov + '®ione=' + reg;
}
qui come vedi c'è il simbolo che ti dicevo che corrisponde a ®..
Invece nel codice html rispetto al tuo codice ho sostituito in alcune righe i doppi apici con l'apice singolo perchè dava errore :
$selected="selected='selected'";
Grazie mille!!
Francesco