mercoledì 8 dicembre 2010

FILTRO CORSI

<?php
$areat=(int)$_GET['ar'];
$regionet=(int)$_GET['re'];
$annot=(int)$_GET['an'];


//DB
$db =& JFactory::getDBO();


$queryz = "SELECT * FROM jos_content WHERE catid = '34'";
$db->setQuery( $queryz, 0 );

$rows = $db->loadObjectList();

$temp_arr=array();
foreach($rows as $row)
{
$ann=substr($row->aggiunto_data,6);

if($ann!='')
if(!in_array($ann,$temp_arr))
$temp_arr[]=$ann;
}
sort($temp_arr);

?>

<form method="POST" style='margin-top: 0px;' action='http://farma.cartonianimated.com/index.php?option=com_jumi&fileid=2&Itemid=56'>
<div style="border: solid 0px green; color: #187558">Filtra per Area</div>
<select name="area" value="" style="width: 180px;">
  <option value='0' <?php if(((int)$_POST['area']==0)||((int)$_GET['ar']==0))echo "selected"; ?>>Tutte</option>
  <option value='1' <?php if(((int)$_POST['area']==1)||((int)$_GET['ar']==1))echo "selected"; ?>>Clinico Scientifica</option>
  <option value='2' <?php if(((int)$_POST['area']==2)||((int)$_GET['ar']==2))echo "selected"; ?>>Normativo Istituzionale</option>
  <option value='3' <?php if(((int)$_POST['area']==3)||((int)$_GET['ar']==3))echo "selected"; ?>>Comunicazione</option>
</select><br><br>
<div style="border: solid 0px green; color: #187558">Filtra per Regione</div>
<select name="regione" value="" style="width: 180px;">
  <option value="0" <?php if(((int)$_POST['regione']==0)||((int)$_GET['re']==0))echo "selected"; ?>>Tutte</option>
  <option value="1" <?php if(((int)$_POST['regione']==1)||((int)$_GET['re']==1))echo "selected"; ?>>Abruzzo</option>
            <option value="2" <?php if(((int)$_POST['regione']==2)||((int)$_GET['re']==2))echo "selected"; ?>>Basilicata</option>
            <option value="3" <?php if(((int)$_POST['regione']==3)||((int)$_GET['re']==3))echo "selected"; ?>>Calabria</option>
                        <option value="4" <?php if(((int)$_POST['regione']==4)||((int)$_GET['re']==4))echo "selected"; ?>>Campania</option>
                        <option value="5" <?php if(((int)$_POST['regione']==5)||((int)$_GET['re']==5))echo "selected"; ?>>Emilia-Romagna</option>
                        <option value="6" <?php if(((int)$_POST['regione']==6)||((int)$_GET['re']==6))echo "selected"; ?>>Friuli-Venezia Giulia</option>
                        <option value="7" <?php if(((int)$_POST['regione']==7)||((int)$_GET['re']==7))echo "selected"; ?>>Lazio</option>
                        <option value="8" <?php if(((int)$_POST['regione']==8)||((int)$_GET['re']==8))echo "selected"; ?>>Liguria</option>
                        <option value="9" <?php if(((int)$_POST['regione']==9)||((int)$_GET['re']==9))echo "selected"; ?>>Lombardia</option>
                        <option value="10" <?php if(((int)$_POST['regione']==10)||((int)$_GET['re']==10))echo "selected"; ?>>Marche</option>
                        <option value="11" <?php if(((int)$_POST['regione']==11)||((int)$_GET['re']==11))echo "selected"; ?>>Molise</option>
                        <option value="12" <?php if(((int)$_POST['regione']==12)||((int)$_GET['re']==12))echo "selected"; ?>>Piemonte</option>
                        <option value="13" <?php if(((int)$_POST['regione']==13)||((int)$_GET['re']==13))echo "selected"; ?>>Puglia</option>
                        <option value="14" <?php if(((int)$_POST['regione']==14)||((int)$_GET['re']==14))echo "selected"; ?>>Sardegna</option>
                        <option value="15" <?php if(((int)$_POST['regione']==15)||((int)$_GET['re']==15))echo "selected"; ?>>Sicilia</option>
                        <option value="16" <?php if(((int)$_POST['regione']==16)||((int)$_GET['re']==16))echo "selected"; ?>>Toscana</option>
                        <option value="17" <?php if(((int)$_POST['regione']==17)||((int)$_GET['re']==17))echo "selected"; ?>>Trentino-Alto Adige</option>
                        <option value="18" <?php if(((int)$_POST['regione']==18)||((int)$_GET['re']==18))echo "selected"; ?>>Umbria</option>
                        <option value="19" <?php if(((int)$_POST['regione']==19)||((int)$_GET['re']==19))echo "selected"; ?>>Valle d'Aosta</option>
                        <option value="20" <?php if(((int)$_POST['regione']==20)||((int)$_GET['re']==20))echo "selected"; ?>>Veneto</option>
</select><br><br>
<div style="border: solid 0px green; color: #187558">Filtra per Anno</div>
<select name="anno" value="" style="width: 180px;">
  <option value='0' <?php if(((int)$_POST['anno']==0)||((int)$_GET['an']==0))echo "selected"; ?>>Attive</option>
  <option value='1' <?php if(((int)$_POST['anno']==1)||((int)$_GET['an']==1))echo "selected"; ?>>Scadute</option>
<?php
foreach($temp_arr as $temp_anno){
echo "<option value='".$temp_anno."' "; if(((int)$_POST['anno']==$temp_anno)||((int)$_GET['an']==$temp_anno))echo "selected";
echo ">$temp_anno</option>";
}
?>
</select>
<br><br>
<input type='submit' value='APPLICA FILTRO' name='submit' style='width: 180px;'>
</form>

Nessun commento:

Posta un commento