Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Variabili di sessione

  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2000
    Messaggi
    52

    Variabili di sessione

    Salve a tutti,
    avendo problemi con il passaggio di variabili da FORM, ho pensato di usare le SESSIONI per uscirne.
    Non ho ottenuto però risultati positivi.
    Le variabili continuano a non essere viste nelle pagine successive.
    Ho controllato la presenza della directory \tmp ed ho settato anche autostart a 1 in php.ini. Niente!
    Forse c'è incompatibilità? Uso php 4.3 ed Easyphp.
    Ecco esattamente i due files di prova (il commento è escluso).

    C'è qualcuno che possa darmi una mano?

    /* prova_sessione.php */

    <?php
    session_start();
    ?>
    <html>
    <head>
    </head>
    <body>
    <?php
    $pluto="Io sono pluto";
    session_register("pluto");
    echo "<a href=prova7.php>Chi è pluto?</a>";
    ?>
    </body>
    </html>


    /* prova7.php */

    <?php
    session_start();
    $_SESSION["pluto"];
    echo $pluto;
    ?>
    <html>
    <head>
    </head>
    <body>
    <?php echo $pluto ;?>
    </body>
    </html>

  2. #2
    Dunque:
    bisogna eseminare come è settata la register_globals

    se è a off solo l'array $_SESSION è utilizzabile per mettere in sessione delle variabili quindi

    /* prova_sessione.php */

    <?php
    session_start();
    ?>
    <html>
    <head>
    </head>
    <body>
    <?php
    $_SESSION["pluto"]="Io sono pluto";

    echo "<a href=prova7.php>Chi è pluto?</a>";
    ?>
    </body>
    </html>


    /* prova7.php */

    <?php
    session_start();


    ?>
    <html>
    <head>
    </head>
    <body>
    <?php echo $_SESSION["pluto"];?>
    </body>
    </html>

    altrimenti



    <?php
    session_start();
    ?>
    <html>
    <head>
    </head>
    <body>
    <?php
    $pluto="Io sono pluto";
    session_register("pluto");
    echo "<a href=prova7.php>Chi è pluto?</a>";
    ?>
    </body>
    </html>


    /* prova7.php */

    <?php
    session_start();
    session_register("pluto");

    ?>
    <html>
    <head>
    </head>
    <body>
    <?php echo $pluto ;?>
    </body>
    </html>
    In a world without walls and fences - who needs windows and gates ?

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2000
    Messaggi
    52
    Originariamente inviato da Darkhorizont
    Dunque:
    bisogna eseminare come è settata la register_globals

    se è a off solo l'array $_SESSION è utilizzabile per mettere in sessione delle variabili quindi

    /* prova_sessione.php */

    <?php
    session_start();
    ?>
    <html>
    <head>
    </head>
    <body>
    <?php
    $_SESSION["pluto"]="Io sono pluto";

    echo "<a href=prova7.php>Chi è pluto?</a>";
    ?>
    </body>
    </html>


    /* prova7.php */

    <?php
    session_start();


    ?>
    <html>
    <head>
    </head>
    <body>
    <?php echo $_SESSION["pluto"];?>
    </body>
    </html>

    altrimenti......
    Register_globals era settato su OFF.
    Seguendo le tue indicazioni sono riuscito a farlo girare bene.
    Grazie!

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.