You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.5 KiB
87 lines
2.5 KiB
5 years ago
|
|
||
|
<br>
|
||
|
|
||
|
<?php
|
||
|
if($_POST['go']){
|
||
|
|
||
|
$q=mysqli_query($dbConn, "UPDATE ambiti SET descrizione='".converti($_POST['ambito'])."', comuni='".implode("#",@$_POST["comune"])."' WHERE id='".$_POST['id']."'");
|
||
|
|
||
|
$id=$_POST['id'];
|
||
|
|
||
|
$q=mysqli_query($dbConn, "UPDATE comuni SET ambito='$id' WHERE id IN (".implode(",",@$_POST["comune"]).")");
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if($q){
|
||
|
@include 'res_ok.php';
|
||
|
}else{
|
||
|
@include 'res_ko.php';
|
||
|
}
|
||
|
|
||
|
|
||
|
}else{
|
||
|
?>
|
||
|
|
||
|
<form method="post">
|
||
|
<table border="0" cellspacing="2" cellpadding="0" width="750">
|
||
|
<tr><td align="left" valign="middle" class="title"> <b>Ambito territoriale</b></td></tr>
|
||
|
<tr><td width="750"><select name="id" style="width: 750px" onChange="this.form.submit()">
|
||
|
<option value=""> - Seleziona l'ambito da modificare - </option>
|
||
|
<?php
|
||
|
$q=mysqli_query($dbConn, "SELECT * FROM ambiti ORDER BY descrizione");
|
||
|
while($r=mysqli_fetch_array($q)){
|
||
|
echo "<option value=\"".$r['id']."\" ";
|
||
|
if($r['id']==@$_POST['id']){echo "selected";}
|
||
|
echo ">".$r['descrizione']."</option>\n";
|
||
|
}
|
||
|
?>
|
||
|
</select></td></tr>
|
||
|
<tr><td align="center" valign="top"> </td></tr>
|
||
|
</table></form>
|
||
|
|
||
|
<?php
|
||
|
if(@$_POST['id']){
|
||
|
$q=mysqli_query($dbConn, "SELECT * FROM ambiti WHERE id='".@$_POST['id']."'");
|
||
|
$r=mysqli_fetch_array($q);
|
||
|
?>
|
||
|
<form method="post">
|
||
|
<input type="hidden" name="id" value="<?php echo $r['id'];?>">
|
||
|
<table border="0" cellspacing="2" cellpadding="0" width="750">
|
||
|
<tr><td align="left" valign="middle" class="title"> <b>Ambito territoriale</b></td></tr>
|
||
|
<tr><td width="750"><input type="text" name="ambito" style="width: 750px" value="<?php echo $r['descrizione'];?>"></td></tr>
|
||
|
<tr><td align="center" valign="top"> </td></tr>
|
||
|
|
||
|
<tr><td align="left" valign="middle" class="title"> <b>Comuni afferenti</b></td></tr>
|
||
|
<tr><td align="left" valign="top">
|
||
|
|
||
|
<table border="0" cellspacing="0" cellpadding="2" width="750">
|
||
|
|
||
|
<?php
|
||
|
$qc=mysqli_query($dbConn, "SELECT * FROM comuni ORDER BY comune");
|
||
|
|
||
|
$item_n=0;
|
||
|
while($rc=mysqli_fetch_array($qc)){
|
||
|
if(($item_n%4)==0){echo "<tr>\n";}
|
||
|
echo "<td class=\"txt_lit_black\" align=\"left\"><input type=\"checkbox\" name=\"comune[]\" value=\"".$rc['id']."\" ".checked(explode("#",$r['comuni']),$rc['id'])."> ".$rc['comune']."</td>\n";
|
||
|
if($item_n==(mysqli_num_rows($qc)-1)){echo "<td colspan=\"".(4-(mysqli_num_rows($qc)%4))."\"></td></tr>\n";}
|
||
|
if(($item_n%4)==3){echo "</tr>\n";}
|
||
|
$item_n++;
|
||
|
}
|
||
|
?>
|
||
|
</table>
|
||
|
</td></tr>
|
||
|
|
||
|
<tr><td align="center" valign="top"> </td></tr>
|
||
|
<tr><td width="750" align="right"><input type="submit" name="go" value=" Modifica ambito " class="button"></td></tr>
|
||
|
<tr><td align="center" valign="top"> </td></tr>
|
||
|
|
||
|
</table>
|
||
|
</form>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
}}
|
||
|
?>
|