Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 22
  1. #1

    menu e sottomenu con casella di riepilogo condizionata

    guardate la pagina non funzionante su itinerarimondo.netsons.org/itinerari.php

    ok allora in pratica io voglio ottenere sulla stessa pagina un menu (nazioni-regioni)e un sottomenu (itinerari) condizionato alla scelta fatta nel menu (nazioni/regioni)
    il database sql è formato da una tabella_nazioni dove ci sono:

    nazioneID nazioni
    1 umbria
    2 belgio
    3 granbretagna

    e una tabella_itinerari composta da:

    itinerarioID nomeitinerario nazione
    1 tour umbria 1
    2 tour bruxelles 2
    3 tour londra 3
    4 tour toscana 1
    5 tour liverpool 3
    un recordet rs_nomeitinerario del tipo:

    SELECT itinerarioID, nomeitinerario, nazioni
    FROM tbl_itinerari
    ORDER BY nomeitinerario ASC

    e un recordset rs_nazioni del tipo:
    SELECT *
    FROM tbl_nazioni

    poi originariamente c'era un solo elenco (frm_peritinerario) a casella di riepilogo agganciato a un recordset (rs_nomeitinerario) che disponeva in ordine alfabetico tutti gli itinerari disponibili nella tabella_itinerari e che rinviava a una pagina itinerari_dettagli.php dove comparivano tutte le giornate di visita relative all'itinerario scelto, il tutto creato col seguente codice:

    <form id="frm_peritinerario" name="frm_peritinerario" method="post" action="itinerari_dettagli.php">
    <select name="nomeitinerario" id="nomeitinerario">
    <?php
    do {
    ?><option value="<?php echo $row_rs_nomeitinerario['itinerarioID']?>"><?php echo $row_rs_nomeitinerario['nomeitinerario']?></option>
    <?php
    } while ($row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario));
    $rows = mysql_num_rows($rs_nomeitinerario);
    if($rows > 0) {
    mysql_data_seek($rs_nomeitinerario, 0);
    $row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario);
    }
    ?>
    </select>
    <input name="Invia" type="submit" id="Invia" value="Invia" />
    </form>

    successivamente ho aggiunto prima dell'altro menu, un secondo elenco/menu di scelta a casella di riepilogo appoggiato a un altro recordset (rs_nazioni) da cui vengono estratte tutte le nazioni disponibili e da cui invece vorrei che dalla scelta compiuta su questa casella dipendesse anche la formazione del contenuto del modulo denominato frm_peritinerario (quello del codice qui sopra). quindi, rimanendo sempre nella stessa pagina, se uno sceglie gran bretagna nel frm_peritinerario devono comparire solo tour londra e tour liverpool e, compiuta la scelta su uno dei due itinerari e cliccato sul tasto submit, si viene trasportati alla pagina itinerari_dettagli.php con i dati relativi a quel tour.

    attualmente il codice di questo modulo (non è un tag form!) è:

    <select name="nomenazione" id="nomenazione">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_nazioni['nazioneID']?>"><?php echo $row_rs_nazioni['nomenazione']?></option>
    <?php
    } while ($row_rs_nazioni = mysql_fetch_assoc($rs_nazioni));
    $rows = mysql_num_rows($rs_nazioni);
    if($rows > 0) {
    mysql_data_seek($rs_nazioni, 0);
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    }
    ?>
    </select>

    come posso fare?

  2. #2
    Codice PHP:
    <select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?IDnazione=+nomenazione.options[this.selectedIndex].value')">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_nazioni['nazioneID']?>"><?php echo $row_rs_nazioni['nomenazione']?></option>
    <?php
    } while ($row_rs_nazioni mysql_fetch_assoc($rs_nazioni));
    $rows mysql_num_rows($rs_nazioni);
    if(
    $rows 0) {
    mysql_data_seek($rs_nazioni0);
    $row_rs_nazioni mysql_fetch_assoc($rs_nazioni);
    }
    ?>
    </select>
    poi dovrai controllare l'esistenza di $_GET['IDnazione'] e fare questa query

    Codice PHP:
    $q_itinerario = @mysql_query("SELECT itinerarioID, nomeitinerario, nazioni FROM tbl_itinerari WHERE nazioni = $_GET[IDnazione] ORDER BY nomeitinerario ASC") or die(mysql_error()); 
    poi fare un ciclo e stampare in una select i risultati che hai ottenuto..


  3. #3
    scusa l'ignoranza.....dove metto GET? e la query? che significa fare il ciclo e stampare con select?

    il codice attuale con la prima modica da te suggerita (senza query e senza GET) è questo:

    <?php require_once('Connections/server.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_server, $server);
    $query_rs_nomeitinerario = "SELECT itinerarioID, nomeitinerario, nazioni FROM tbl_itinerari ORDER BY nomeitinerario ASC";
    $rs_nomeitinerario = mysql_query($query_rs_nomeitinerario, $server) or die(mysql_error());
    $row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario);
    $totalRows_rs_nomeitinerario = mysql_num_rows($rs_nomeitinerario);

    mysql_select_db($database_server, $server);
    $query_rs_nazioni = "SELECT nazioneID, nomenazione FROM tbl_nazioni ORDER BY nomenazione ASC";
    $rs_nazioni = mysql_query($query_rs_nazioni, $server) or die(mysql_error());
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    $totalRows_rs_nazioni = mysql_num_rows($rs_nazioni);

    mysql_select_db($database_server, $server);
    $query_rs_nomecontinente = "SELECT continenteID, nomecontinente FROM tbl_continenti ORDER BY nomecontinente ASC";
    $rs_nomecontinente = mysql_query($query_rs_nomecontinente, $server) or die(mysql_error());
    $row_rs_nomecontinente = mysql_fetch_assoc($rs_nomecontinente);
    $totalRows_rs_nomecontinente = mysql_num_rows($rs_nomecontinente);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <title>Itinerari</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="mm_travel2.css" type="text/css" />
    <script language="JavaScript" type="text/javascript">
    //--------------- LOCALIZEABLE GLOBALS ---------------
    var d=new Date();
    var monthname=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggi o","Giugno","Luglio","Agosto","Settembre","Ottobre ","Novembre","Dicembre");
    //Ensure correct for language. English is "1 Gennaio, 2004"
    var TODAY = d.getDate() + " " + monthname[d.getMonth()] + " " + d.getFullYear();
    //--------------- END LOCALIZEABLE ---------------
    </script>
    </head>
    <body bgcolor="#C0DFFD">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#3366CC">
    <td colspan="3" rowspan="2">[img]mm_travel_photo.jpg[/img]</td>
    <td height="63" colspan="3" align="center" valign="bottom" nowrap="nowrap" id="logo"><div align="center"><span class="pageName Stile8"><span class="pageName Stile10"><span class="pageName Stile8"><span class="pageName Stile14"><span class="pageName Stile16"><span class="pageName Stile14"><span class="pageName Stile8 Stile23"> Itinerari nel Mondo </span></span></span></span></span></span></span></div></td>
    <td width="252"></td>
    </tr>

    <tr bgcolor="#3366CC">
    <td height="55" colspan="3" id="tagline" valign="top" align="center"></td>
    <td width="252"></td>
    </tr>

    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <tr bgcolor="#CCFF99">
    <td colspan="7" id="dateformat" height="25"><script language="JavaScript" type="text/javascript">
    document.write(TODAY); </script> </td>
    </tr>
    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <td width="380"></span></td>
    </tr> <tr>
    <td></td>
    </tr>
    </table>
    <div class="navText Stile54" id="menuorizzontale">
    <p align="center" class="bodyText"> Home / I Nostri Viaggi / Forum / Guestbook / Newsgroup / Utilink</p>
    </div>
    <div id="contactus">
    <p class="subHeader">Contact Us | 2007 Marco &amp; Gabriella </p>
    </div>


    </p>
    <table width="27%" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <th height="27" valign="middle" scope="col"><span class="Stile56">Cerca l'itinerario </span></th>
    </tr>
    </table>


    </p>


    </p>
    <table width="95%" border="1" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td width="41%">Per Continente </td>
    <td width="59%"><form id="frm_percontinente" name="frm_percontinente" method="post" action="">

    funzione attualmente non disponibile
    </form> </td>
    </tr>
    <tr>
    <td>Per Nazione o Regione italiana </td>
    <td><select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?IDnazione=+nomenazione.options[this.selectedIndex].value')">>
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_nazioni['nazioneID']?>"><?php echo $row_rs_nazioni['nomenazione']?></option>
    <?php
    } while ($row_rs_nazioni = mysql_fetch_assoc($rs_nazioni));
    $rows = mysql_num_rows($rs_nazioni);
    if($rows > 0) {
    mysql_data_seek($rs_nazioni, 0);
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    }
    ?>
    </select></td>
    </tr>
    <tr>
    <td>Scegli tra tutti gli itinerari </td>
    <td><form id="frm_peritinerario" name="frm_peritinerario" method="post" action="itinerari_dettagli.php">
    <select name="nomeitinerario" id="nomeitinerario">
    <?php
    do {
    ?><option value="<?php echo $row_rs_nomeitinerario['itinerarioID']?>"><?php echo $row_rs_nomeitinerario['nomeitinerario']?></option>
    <?php
    } while ($row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario));
    $rows = mysql_num_rows($rs_nomeitinerario);
    if($rows > 0) {
    mysql_data_seek($rs_nomeitinerario, 0);
    $row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario);
    }
    ?>
    </select>
    <input name="Invia" type="submit" id="Invia" value="Invia" />
    </form> </td>
    </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rs_nomeitinerario);

    mysql_free_result($rs_nazioni);

    mysql_free_result($rs_nomecontinente);
    ?>

  4. #4
    Codice PHP:
    if($_GET['IDnazione'] && $_GET['IDnazione'] > 0)
    {
    $query_rs_nomeitinerario "SELECT itinerarioID, nomeitinerario, nazioni FROM tbl_itinerari WHERE nazioni = $_GET[IDnazione] ORDER BY nomeitinerario ASC";
    $rs_nomeitinerario = @mysql_query($query_rs_nomeitinerario$server) or die(mysql_error());
    $row_rs_nomeitinerario = @mysql_fetch_assoc($rs_nomeitinerario);
    $totalRows_rs_nomeitinerario = @mysql_num_rows($rs_nomeitinerario);

    poi

    Codice PHP:
    <select name="nomeitinerario" id="nomeitinerario">
    <option value="null">-------</option>
    <?php
    do {
    ?><option value="<?php echo $row_rs_nomeitinerario['itinerarioID']?>"><?php echo $row_rs_nomeitinerario['nomeitinerario']?></option>
    <?php
    } while ($row_rs_nomeitinerario mysql_fetch_assoc($rs_nomeitinerario));
    $rows mysql_num_rows($rs_nomeitinerario);
    if(
    $rows 0) {
    mysql_data_seek($rs_nomeitinerario0);
    $row_rs_nomeitinerario mysql_fetch_assoc($rs_nomeitinerario);
    }
    ?>

  5. #5
    bene! direi che ci siamo quasi ma forse ho sbagliato qualcosa...

    mi carica il null nella casella nomeitinerario ma contemporaneamente mi dà questo errore

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/netsons.org/itinerarimondo/itinerari.php on line 317


    in pratica qui sotto hai il codice dall linea 316 alla 322:

    <?php
    mysql_free_result($rs_nomeitinerario);

    mysql_free_result($rs_nazioni);

    mysql_free_result($rs_nomecontinente);
    ?>

    per sicurezza ti ricopio nuovamente il codice di tutta la pagina con le modifiche suggerite da te, sperando di averle ben recepite:

    <?php require_once('Connections/server.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_server, $server);
    if($_GET['IDnazione'] && $_GET['IDnazione'] > 0)
    {
    $query_rs_nomeitinerario = "SELECT itinerarioID, nomeitinerario, nazioni FROM tbl_itinerari WHERE nazioni = $_GET[IDnazione] ORDER BY nomeitinerario ASC";
    $rs_nomeitinerario = @mysql_query($query_rs_nomeitinerario, $server) or die(mysql_error());
    $row_rs_nomeitinerario = @mysql_fetch_assoc($rs_nomeitinerario);
    $totalRows_rs_nomeitinerario = @mysql_num_rows($rs_nomeitinerario);
    }

    mysql_select_db($database_server, $server);
    $query_rs_nazioni = "SELECT nazioneID, nomenazione FROM tbl_nazioni ORDER BY nomenazione ASC";
    $rs_nazioni = mysql_query($query_rs_nazioni, $server) or die(mysql_error());
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    $totalRows_rs_nazioni = mysql_num_rows($rs_nazioni);

    mysql_select_db($database_server, $server);
    $query_rs_nomecontinente = "SELECT continenteID, nomecontinente FROM tbl_continenti ORDER BY nomecontinente ASC";
    $rs_nomecontinente = mysql_query($query_rs_nomecontinente, $server) or die(mysql_error());
    $row_rs_nomecontinente = mysql_fetch_assoc($rs_nomecontinente);
    $totalRows_rs_nomecontinente = mysql_num_rows($rs_nomecontinente);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <title>Itinerari</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="mm_travel2.css" type="text/css" />
    <script language="JavaScript" type="text/javascript">
    //--------------- LOCALIZEABLE GLOBALS ---------------
    var d=new Date();
    var monthname=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggi o","Giugno","Luglio","Agosto","Settembre","Ottobre ","Novembre","Dicembre");
    //Ensure correct for language. English is "1 Gennaio, 2004"
    var TODAY = d.getDate() + " " + monthname[d.getMonth()] + " " + d.getFullYear();
    //--------------- END LOCALIZEABLE ---------------
    </script>
    <style type="text/css">
    <!--
    @import url("mm_travel3.css");
    .ws22 {font-size: 29px;}
    .Stile23 {font-size: 24px}
    #menuverticale {
    position:absolute;
    width:178px;
    height:256px;
    z-index:1;
    left: 1px;
    top: 192px;
    border-top-width: 0px;
    border-right-width: 0px;
    border-bottom-width: 0px;
    border-left-width: 0px;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    }
    #Layer2 {
    position:absolute;
    width:750px;
    height:20px;
    z-index:2;
    left: 200px;
    top: 200px;
    }
    #Layer3 {
    position:absolute;
    width:750px;
    height:39px;
    z-index:1;
    top: 20px;
    }
    #Layer4 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:3;
    left: 196px;
    top: 473px;
    }
    #menuorizzontale {
    position:absolute;
    width:727px;
    height:23px;
    z-index:2;
    left: 237px;
    top: 162px;
    background-color: #e6f3ff;
    }
    .Stile54 {
    font-size: 14px;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    }
    #itinerario {
    position:absolute;
    width:795px;
    height:907px;
    z-index:3;
    left: 185px;
    top: 192px;
    border: 0px none #CCCCCC;
    list-style-image: none;
    list-style-type: none;
    padding-right: 5px;
    padding-left: 5px;
    }
    #Layer7 {
    position:absolute;
    width:200px;
    height:144px;
    z-index:4;
    left: 964px;
    top: 195px;
    }
    #listamappe {
    position:absolute;
    width:200px;
    height:808px;
    z-index:4;
    left: 1003px;
    top: 193px;
    text-indent: 2px;
    display: inline;
    letter-spacing: normal;
    border: 2px solid #CCCCCC;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    }
    #contactus {
    position:absolute;
    width:1239px;
    height:24px;
    z-index:5;
    left: 1px;
    top: 804px;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    border-top-color: #CCCCCC;
    border-right-color: #CCCCCC;
    border-bottom-color: #CCCCCC;
    border-left-color: #CCCCCC;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    }
    .Stile56 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #0033CC;
    font-size: 18px;
    font-style: normal;
    }
    -->
    </style>
    </head>
    <body bgcolor="#C0DFFD">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#3366CC">
    <td colspan="3" rowspan="2">[img]mm_travel_photo.jpg[/img]</td>
    <td height="63" colspan="3" align="center" valign="bottom" nowrap="nowrap" id="logo"><div align="center"><span class="pageName Stile8"><span class="pageName Stile10"><span class="pageName Stile8"><span class="pageName Stile14"><span class="pageName Stile16"><span class="pageName Stile14"><span class="pageName Stile8 Stile23"> Itinerari nel Mondo </span></span></span></span></span></span></span></div></td>
    <td width="252"></td>
    </tr>

    <tr bgcolor="#3366CC">
    <td height="55" colspan="3" id="tagline" valign="top" align="center"></td>
    <td width="252"></td>
    </tr>

    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <tr bgcolor="#CCFF99">
    <td colspan="7" id="dateformat" height="25"><script language="JavaScript" type="text/javascript">
    document.write(TODAY); </script> </td>
    </tr>
    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <td width="380"></span></td>
    </tr> <tr>
    <td></td>
    </tr>
    </table>
    <div class="navText Stile54" id="menuorizzontale">
    <p align="center" class="bodyText"> Home / I Nostri Viaggi / Forum / Guestbook / Newsgroup / Utilink</p>
    </div>
    <div id="contactus">
    <p class="subHeader">Contact Us | 2007 Marco &amp; Gabriella </p>
    </div>


    </p>
    <table width="27%" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <th height="27" valign="middle" scope="col"><span class="Stile56">Cerca l'itinerario </span></th>
    </tr>
    </table>


    </p>


    </p>
    <table width="95%" border="1" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td width="41%">Per Continente </td>
    <td width="59%"><form id="frm_percontinente" name="frm_percontinente" method="post" action="">

    funzione attualmente non disponibile
    </form> </td>
    </tr>
    <tr>
    <td>Per Nazione o Regione italiana </td>
    <td><select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?IDnazione=+nomenazione.options[this.selectedIndex].value')">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_nazioni['nazioneID']?>"><?php echo $row_rs_nazioni['nomenazione']?></option>
    <?php
    } while ($row_rs_nazioni = mysql_fetch_assoc($rs_nazioni));
    $rows = mysql_num_rows($rs_nazioni);
    if($rows > 0) {
    mysql_data_seek($rs_nazioni, 0);
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    }
    ?>
    </select></td>
    </tr>
    <tr>
    <td>Scegli tra tutti gli itinerari </td>
    <td><form id="frm_peritinerario" name="frm_peritinerario" method="post" action="itinerari_dettagli.php">
    <select name="nomeitinerario" id="nomeitinerario">
    <option value="null">-------</option>
    <?php
    do {
    ?><option value="<?php echo $row_rs_nomeitinerario['itinerarioID']?>"><?php echo $row_rs_nomeitinerario['nomeitinerario']?></option>
    <?php
    } while ($row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario));
    $rows = mysql_num_rows($rs_nomeitinerario);
    if($rows > 0) {
    mysql_data_seek($rs_nomeitinerario, 0);
    $row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario);
    }
    ?>
    </select>
    <input name="Invia" type="submit" id="Invia" value="Invia" />
    </form> </td>
    </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rs_nomeitinerario);

    mysql_free_result($rs_nazioni);

    mysql_free_result($rs_nomecontinente);
    ?>

    grazie molte per la pazienza!

  6. #6
    al momento ho eliminato tutte le sql free result (non so se ho fatto bene) e ho sostituito IDnazione (indicato da te) con nazioneID (esatta denominazione campo indicato in tabella)
    ho caricato la pagina sul server...tutto ok nessun errore ma nel sottomenu non mi escono fuori gli itinerari collegati alla scelta del menu (nazioni)
    come mai?


    PS: è indifferente usare mysql_query oppure @mysql_query?

  7. #7
    io utilizzo sempre così...
    @mysql_query("query") or die(mysql_error());

    è solo per gli errori, la chiocciola @ evita che vengano stampati gli errori..

    poi, sicuro di aver sostituito tutti i IDnazione con nazioneID??

  8. #8
    http://itinerarimondo.netsons.org/it...azione.options[this.selectedIndex].value
    ecco perchè...

    scrivimi le parti di codice che hai modificato tu


    EDIT:

    cambia così:

    Codice PHP:
    <select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?nazioneID='+nomenazione.options[this.selectedIndex].value)">

  9. #9
    sicurissimo

    secondo me c'è qualcosa che non va nella prima query rs_nomitinerario...sono giusti gli spazi, gli a capo, ecc?

    guarda che succede su www.itinerarimondo.netsons.org/itinerari.php

    l'ultimo codice completo e corretto è questo:

    <?php require_once('Connections/server.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    mysql_select_db($database_server, $server);
    if($_GET['nazioneID'] && $_GET['nazioneID'] > 0)
    {
    $query_rs_nomeitinerario = "SELECT itinerarioID, nomeitinerario, nazioni FROM tbl_itinerari WHERE nazioni = $_GET[nazioneID] ORDER BY nomeitinerario ASC";
    $rs_nomeitinerario = @mysql_query($query_rs_nomeitinerario, $server) or die(mysql_error());
    $row_rs_nomeitinerario = @mysql_fetch_assoc($rs_nomeitinerario);
    $totalRows_rs_nomeitinerario = @mysql_num_rows($rs_nomeitinerario);
    }

    mysql_select_db($database_server, $server);
    $query_rs_nazioni = "SELECT nazioneID, nomenazione FROM tbl_nazioni ORDER BY nomenazione ASC";
    $rs_nazioni = mysql_query($query_rs_nazioni, $server) or die(mysql_error());
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    $totalRows_rs_nazioni = mysql_num_rows($rs_nazioni);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Itinerari</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="mm_travel2.css" type="text/css" />
    <script language="JavaScript" type="text/javascript">
    //--------------- LOCALIZEABLE GLOBALS ---------------
    var d=new Date();
    var monthname=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggi o","Giugno","Luglio","Agosto","Settembre","Ottobre ","Novembre","Dicembre");
    //Ensure correct for language. English is "1 Gennaio, 2004"
    var TODAY = d.getDate() + " " + monthname[d.getMonth()] + " " + d.getFullYear();
    //--------------- END LOCALIZEABLE ---------------
    </script>
    <style type="text/css">
    <!--
    @import url("mm_travel3.css");
    .ws22 {font-size: 29px;}
    .Stile23 {font-size: 24px}
    #menuverticale {
    position:absolute;
    width:178px;
    height:256px;
    z-index:1;
    left: 1px;
    top: 192px;
    border-top-width: 0px;
    border-right-width: 0px;
    border-bottom-width: 0px;
    border-left-width: 0px;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    }
    #Layer2 {
    position:absolute;
    width:750px;
    height:20px;
    z-index:2;
    left: 200px;
    top: 200px;
    }
    #Layer3 {
    position:absolute;
    width:750px;
    height:39px;
    z-index:1;
    top: 20px;
    }
    #Layer4 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:3;
    left: 196px;
    top: 473px;
    }
    #menuorizzontale {
    position:absolute;
    width:727px;
    height:23px;
    z-index:2;
    left: 237px;
    top: 162px;
    background-color: #e6f3ff;
    }
    .Stile54 {
    font-size: 14px;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    }
    #itinerario {
    position:absolute;
    width:795px;
    height:907px;
    z-index:3;
    left: 185px;
    top: 192px;
    border: 0px none #CCCCCC;
    list-style-image: none;
    list-style-type: none;
    padding-right: 5px;
    padding-left: 5px;
    }
    #Layer7 {
    position:absolute;
    width:200px;
    height:144px;
    z-index:4;
    left: 964px;
    top: 195px;
    }
    #listamappe {
    position:absolute;
    width:200px;
    height:808px;
    z-index:4;
    left: 1003px;
    top: 193px;
    text-indent: 2px;
    display: inline;
    letter-spacing: normal;
    border: 2px solid #CCCCCC;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    }
    #contactus {
    position:absolute;
    width:1239px;
    height:24px;
    z-index:5;
    left: 1px;
    top: 804px;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    border-top-color: #CCCCCC;
    border-right-color: #CCCCCC;
    border-bottom-color: #CCCCCC;
    border-left-color: #CCCCCC;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    }
    .Stile56 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #0033CC;
    font-size: 18px;
    font-style: normal;
    }
    -->
    </style>
    </head>
    <body bgcolor="#C0DFFD">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#3366CC">
    <td colspan="3" rowspan="2">[img]mm_travel_photo.jpg[/img]</td>
    <td height="63" colspan="3" align="center" valign="bottom" nowrap="nowrap" id="logo"><div align="center"><span class="pageName Stile8"><span class="pageName Stile10"><span class="pageName Stile8"><span class="pageName Stile14"><span class="pageName Stile16"><span class="pageName Stile14"><span class="pageName Stile8 Stile23"> Itinerari nel Mondo </span></span></span></span></span></span></span></div></td>
    <td width="252"></td>
    </tr>

    <tr bgcolor="#3366CC">
    <td height="55" colspan="3" id="tagline" valign="top" align="center"></td>
    <td width="252"></td>
    </tr>

    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <tr bgcolor="#CCFF99">
    <td colspan="7" id="dateformat" height="25"><script language="JavaScript" type="text/javascript">
    document.write(TODAY); </script> </td>
    </tr>
    <tr>
    <td colspan="7" bgcolor="#003366">[img]mm_spacer.gif[/img]</td>
    </tr>

    <td width="380"></span></td>
    </tr> <tr>
    <td></td>
    </tr>
    </table>
    <div class="navText Stile54" id="menuorizzontale">
    <p align="center" class="bodyText"> Home / I Nostri Viaggi / Forum / Guestbook / Newsgroup / Utilink</p>
    </div>
    <div id="contactus">
    <p class="subHeader">Contact Us | 2007 Marco &amp; Gabriella </p>
    </div>


    </p>
    <table width="27%" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <th height="27" valign="middle" scope="col"><span class="Stile56">Cerca l'itinerario </span></th>
    </tr>
    </table>


    </p>


    </p>
    <table width="95%" border="1" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td width="41%">Per Continente </td>
    <td width="59%"><form id="frm_percontinente" name="frm_percontinente" method="post" action="">

    funzione attualmente non disponibile
    </form> </td>
    </tr>
    <tr>
    <td>Per Nazione o Regione italiana </td>
    <td><select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?nazioneID=+nomenazione.options[this.selectedIndex].value')">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_nazioni['nazioneID']?>"><?php echo $row_rs_nazioni['nomenazione']?></option>
    <?php
    } while ($row_rs_nazioni = mysql_fetch_assoc($rs_nazioni));
    $rows = mysql_num_rows($rs_nazioni);
    if($rows > 0) {
    mysql_data_seek($rs_nazioni, 0);
    $row_rs_nazioni = mysql_fetch_assoc($rs_nazioni);
    }
    ?>
    </select></td>
    </tr>
    <tr>
    <td>Scegli tra tutti gli itinerari </td>
    <td><form id="frm_peritinerario" name="frm_peritinerario" method="post" action="itinerari_dettagli.php">
    <select name="nomeitinerario" id="nomeitinerario">
    <option value="null">-------</option>
    <?php
    do {
    ?><option value="<?php echo $row_rs_nomeitinerario['itinerarioID']?>" selected="selected"><?php echo $row_rs_nomeitinerario['nomeitinerario']?></option>
    <?php
    } while ($row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario));
    $rows = mysql_num_rows($rs_nomeitinerario);
    if($rows > 0) {
    mysql_data_seek($rs_nomeitinerario, 0);
    $row_rs_nomeitinerario = mysql_fetch_assoc($rs_nomeitinerario);
    }
    ?>
    </select>
    <input name="Invia" type="submit" id="Invia" value="Invia" />
    </form> </td>
    </tr>
    </table>
    </body>
    </html>

  10. #10
    come scritto sopra il problema è che ho dimenticato un apice qui... cambia in questo modo:

    codice:
    <select name="nomenazione" id="nomenazione" onchange="window.location = ('<?php echo $_SERVER['PHP_SELF']; ?>?nazioneID='+nomenazione.options[this.selectedIndex].value)">

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.