source: trunk/client/file.php@ 21

Last change on this file since 21 was 15, checked in by roby, 15 years ago

Gestione charset (da Tolaini)

File size: 2.1 KB
RevLine 
[2]1<?php
2
3include("config.php");
4if(!$dbi = mysql_connect($dbhost, $dbuname, $dbpass)){
5die("<center><img src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br><br><b>Ci sono dei problemi di connessione al Server $dbtype, chiediamo scusa per l'inconveniente.<br><br>Provate piu' tardi, Grazie.</b><br><font color=\"#ff0000\">". mysql_error()."</font></center>");
6}
7$fase=intval($_GET['fase']);
8
9if(!mysql_select_db($dbname)){
10die("<center><img src=src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br><br><b>Ci sono dei problemi di connessione al DataBase $dbtype, chiediamo scusa per l'inconveniente.<br><br>Provate piu' tardi, Grazie.</b><br><font color=\"#ff0000\">". mysql_error()."</font></center>");
11}
[15]12mysql_set_charset('utf8', $dbi);
[2]13if ($fase=='1'){
14 $res = mysql_query("SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione",$dbi);
15Header("content-type: application/x-javascript");
16echo "document.write(\"<b><select name=\'id_cons_gen2\'>";
17
18while(list($id_cons_gen2,$descr) = mysql_fetch_row($res)) {
19 echo "<option value=\'$id_cons_gen2\'>$descr";
20 }
21 echo "</select>";
22mysql_data_seek($res,0);
23while(list($id_cons_gen2,$descr) = mysql_fetch_row($res)) {
24 echo "<input type=\'hidden\' name=\'$id_cons_gen2\' value=\'$descr\'>";
25 }
26echo "</b>\")";
27
28}elseif ($fase=='2'){
29 $id_cons_gen2=intval($_GET['id_cons_gen2']);
30 $rescons = mysql_query("SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'",$dbi);
31 list($descr_cons) = mysql_fetch_row($rescons);
32 $res = mysql_query("SELECT t2.id_comune,t2.descrizione from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_comuni as t2 on t1.id_comune=t2.id_comune where t1.id_cons_gen=$id_cons_gen2 order by t2.descrizione ",$dbi);
33Header("content-type: application/x-javascript");
34echo "document.write(\"<b><input type=\'hidden\' name=\'id_cons_gen2\' value=\'$id_cons_gen2\'><select name=\'id_comune2\'>";
35
36while(list($id_comune2,$descr) = mysql_fetch_row($res)) {
37 echo "<option value=\'$id_comune2\'>$descr";
38 }
39 echo "</select>";
40echo "</b>\")";
41}
42
43
44?>
Note: See TracBrowser for help on using the repository browser.