Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    come far puntare header ?

    Ciao!

    Nel seguente form di una rubrica dopo aver inserito i dati ottengo il seguente errore



    Warning: Cannot modify header information - headers already sent by (output started at e:\programmi\apache group\apache\htdocs\inseriscidati2.php:1) in e:\programmi\apache group\apache\htdocs\inseriscidati2.php on line 18


    il listato che uso è il seguente :

    <?php
    if (isset($_POST['nome'])){
    include("dati.txt");
    $link = mysql_connect($db_host, $db_login, $db_pass) or die (mysql_error());
    mysql_select_db($database) or die (mysql_error());
    $dati = "INSERT INTO rubrica VALUES ('', ";
    $dati .= "'" . addslashes($_POST['titolo']) . "', ";
    $dati .= "'" . addslashes($_POST['nome']) . "', ";
    $dati .= "'" . addslashes($_POST['cognome']) . "', ";
    $dati .= "'" . addslashes($_POST['via']) . "', ";
    $dati .= "'" . addslashes($_POST['citta']) . "', ";
    $dati .= "'" . addslashes($_POST['provoncia']) . "', ";
    $dati .= "'" . $_POST['cap'] . "', ";
    $dati .= "'" . $_POST['tel'] . "', ";
    $dati .= "'" . $_POST['fax'] . "')";
    mysql_query ($dati) or die (mysql_error());
    echo "<meta http-equiv=refresh content=3;url=$PATH_INFO>";
    Header("Location: ". $link_to_redirect);


    }
    ?>

    <html>
    <head>
    <meta name=Proprietà content=Apache3000>
    <meta name=ProgId content=PHP Pratico>
    <title>Form RUBRICA</title>
    </head>
    <body>
    <TABLE border=0 width=100% cellpadding=3>
    <tr>
    <td width=100% colspan=2>
    <p align=center>Inserisci nuovi recapiti nella rubrica
    <form method=POST action=<? $PATH_INFO ?>>
    </td>
    </tr>
    <tr>
    <td width=18%>Titolo</td>
    <td width=82%><input type=text name=titolo size=20></td>
    </tr>
    <tr>
    <td width=18%>Nome</td>
    <td width=82%><input type=text name=nome size=20></td>
    </tr>
    <tr>
    <td width=18%>Cognome</td>
    <td width=82%><input type=text name=cognome size=20></td>
    </tr>
    <tr>
    <td width=18%>Via</td>
    <td width=82%><input type=text name=via size=20></td>
    </tr>
    <tr>
    <td width=18%>Città</td>
    <td width=82%><input type=text name=citta size=20></td>
    </tr>
    <tr>
    <td width=18%>Provincia</td>
    <td width=82%><input type=text name=provincia size=20></td>
    </tr>
    <tr>
    <td width=18%>CAP</td>
    <td width=82%><input type=text name=cap size=20></td>
    </tr>
    <tr>
    <td width=18%>Telefono</td>
    <td width=82%><input type=text name=tel size=20></td>
    </tr>
    <tr>
    <td width=18%>Cellulare</td>
    <td width=82%><input type=text name=cell size=20></td>
    </tr>
    <tr>
    <td width=18%><input type=submit value=Inserisci nuovi dati></td>
    <td width=82%></form></td>
    </tr>
    </table>
    </body>
    </html>

    come faccio ad correggere l' header?

    Grazie
    Php4ever!

  2. #2
    cancella questa riga:

    echo "<meta http-equiv=refresh content=3;url=$PATH_INFO>";
    Addio Aldo, amico mio... [03/12/70 - 16/08/03]

  3. #3
    mmmm fatto ,ma mi ridà lo stesso errore




    Warning: Cannot modify header information - headers already sent by (output started at e:\programmi\apache group\apache\htdocs\inseriscidati2.php:1) in e:\programmi\apache group\apache\htdocs\inseriscidati2.php on line 18
    Php4ever!

  4. #4
    Arriva qualcosa al browser prima di header.

    Controlla che non ci siano spazi e/o invii prima di <?php oppure nel file che includi
    Addio Aldo, amico mio... [03/12/70 - 16/08/03]

  5. #5
    ok

    la sintassi era corretta ma erano gli spazi che facevano arivare qualcosa al browser

    ora funziona grazie!!
    Php4ever!

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.