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.
60 lines
1.6 KiB
60 lines
1.6 KiB
<br>
|
|
|
|
<?php
|
|
if($_POST['go']){
|
|
|
|
if($_POST['ambito']){
|
|
$q=mysqli_query($dbConn, "INSERT INTO ambiti VALUES(null,'".converti($_POST['ambito'])."','".implode("#",@$_POST["comune"])."')");
|
|
$id=mysqli_insert_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>Nuovo ambito territoriale</b></td></tr>
|
|
<tr><td width="750"><input type="text" name="ambito" style="width: 750px"></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
|
|
$q=mysqli_query($dbConn, "SELECT * FROM comuni ORDER BY comune");
|
|
|
|
$item_n=0;
|
|
while($r=mysqli_fetch_array($q)){
|
|
if(($item_n%4)==0){echo "<tr>\n";}
|
|
echo "<td class=\"txt_lit_black\" align=\"left\"><input type=\"checkbox\" name=\"comune[]\" value=\"".$r['id']."\"> ".$r['comune']."</td>\n";
|
|
if($item_n==(mysqli_num_rows($q)-1)){echo "<td colspan=\"".(4-(mysqli_num_rows($q)%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=" Salva ambito " class="button"></td></tr>
|
|
<tr><td align="center" valign="top"> </td></tr>
|
|
|
|
</table>
|
|
</form>
|
|
|
|
|
|
<?php
|
|
}
|
|
?>
|