Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    56

    problema con semplice script

    Ho prelevato il seguente script da una guida sul php, ma quando lo lancio in locale con EasyPHP mi da comunque il seguente errore:
    Notice: Undefined variable: inviato in c:\programmi\easyphp1-8\www\php\prova.php on line 4

    questo é il file
    prova.php

    <html>
    <head>
    <?php
    if ($inviato)
    {
    echo "Il seguente nome é stato";
    echo " immesso: $nm $cg

    ";
    }
    ?>
    </head>
    <body>
    Digitate un nome e inviate il form:
    <form action = "prova.php" method = "post">
    <input name = "cg"> cognome


    <input name = "nm"> nome


    <input type = "submit" name = "inviato">
    <input type = "reset">
    </form>
    </body>
    </html>

    Grazie per l'attenzione

  2. #2
    Prova con:

    Codice PHP:
    <html>
    <head>
    <?php
    if (isset($_POST['inviato'])) {
    echo(
    "Il seguente nome &egrave; stato");
    echo(
    " immesso: " . @$_POST['nm'] . " " . @$_POST['cg'] . "

    "
    );
    }
    ?>
    </head>
    <body>
    Digitate un nome e inviate il form:
    <form action="prova.php" method = "post">
      <input name="cg" />
      cognome

      <input name="nm" />
      nome

      <input type="submit" name="inviato"/>
      <input type="reset" />
    </form>
    </body>
    </html>
    E leggiti la seguente pagina di manuale:

    http://www.php.net/manual/it/tutorial.forms.php

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    56

    ok grazie

    Originariamente inviato da filippo.toso
    Prova con:

    Codice PHP:
    <html>
    <head>
    <?php
    if (isset($_POST['inviato'])) {
    echo(
    "Il seguente nome &egrave; stato");
    echo(
    " immesso: " . @$_POST['nm'] . " " . @$_POST['cg'] . "

    "
    );
    }
    ?>
    </head>
    <body>
    Digitate un nome e inviate il form:
    <form action="prova.php" method = "post">
      <input name="cg" />
      cognome

      <input name="nm" />
      nome

      <input type="submit" name="inviato"/>
      <input type="reset" />
    </form>
    </body>
    </html>
    E leggiti la seguente pagina di manuale:

    http://www.php.net/manual/it/tutorial.forms.php

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 © 2024 vBulletin Solutions, Inc. All rights reserved.