Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656

    "headers already sent" - che significa???

    Ciao a tutti,

    ho creato un form per l'inserimeto di un record in mysql.

    Pero dopo aver cliccato sul bottone invia mi compare questo messaggio??
    Che significa? Dove è l'errore??

    Tengo a precisare che i dati vengono salvati comunque nel db.


    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/lnx.commercialevirtuale.com/httpdocs/cv-reg.php:1) in /var/www/vhosts/lnx.commercialevirtuale.com/httpdocs/cv-reg.php on line 50

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    tiro ad indovinare: stai provando a far partire una sessione, oppure a fare un redirect con direttiva header("Location: ...) o simili.

    Intanto, posta un po' di codice, però se il panorama di cui sopra comprende il tuo caso, sappi che tali operazioni vanno inserite come primissime istruzioni nei tuoi script (nella pagina) e sicuramente prima dell'output a browser (e quello è il motivo del warning che ricevi). Per output a browser si intende anche un singolo blank o una riga saltata tra ?> ed un successivo <?php
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656
    il codice di tutta la pagina:


    <?php virtual('/Connections/symbio.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
    }

    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    $insertSQL = sprintf("INSERT INTO reg (nome, indirizzo, email, cat, sugg, `desc`) VALUES (%s, %s, %s, %s, %s, %s)",
    GetSQLValueString($_POST['textfield'], "text"),
    GetSQLValueString($_POST['textfield2'], "text"),
    GetSQLValueString($_POST['textfield3'], "text"),
    GetSQLValueString($_POST['categoria'], "text"),
    GetSQLValueString($_POST['textarea'], "text"),
    GetSQLValueString($_POST['categoria_suggerita'], "text"));

    mysql_select_db($database_symbio, $symbio);
    $Result1 = mysql_query($insertSQL, $symbio) or die(mysql_error());

    $insertGoTo = "http:://www.commercialevirtuale.com/reg_ok.htm";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
    }
    ?><!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>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    <script type="text/javascript">
    <!--
    function scambio(id){
    if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
    document.getElementById(id).style.display = 'block';
    } else {
    document.getElementById(id).style.display = 'none';
    }
    }
    }
    -->
    </script>
    </head>

    <body>
    <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td></td>
    </tr>
    <tr>
    <td></td>
    </tr>
    </table>
    <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><div align="right">
    <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
    <label>Nome sito
    <input type="text" name="textfield" />
    </label>



    <label>Indirizzo
    <input type="text" name="textfield2" />
    </label>
    </p>



    <label>Email
    <input type="text" name="textfield3" />
    </label>
    </p>


    <label>Categoria </label>
    <select size="1" name="categoria">
    <option>abbigliamento</option>
    <option>auto&moto</option>
    <option>casa&giardino</option>
    <option>cibo&bevande</option>
    <option>elettronica</option>
    <option>film&dvd</option>
    <option>fotografia</option>
    <option>giocattoli</option>
    <option>gioielli</option>
    <option>informatica</option>
    <option>internet</option>
    <option>libri&riviste</option>
    <option>musica</option>
    <option>salute&benessere</option>
    <option>sport</option>
    <option>telefonia</option>
    <option>viaggi&vacanze</option>
    <option>videogiochi</option>
    <option>servizi</option>
    <option>suggerisco nuova categoria</option>
    </select></p>
    <p align="right">
    <div style="border:0px solid orange; width:389px; text-align:left; height:40px">
    <p style="text-align: right"><a href="#" onclick="scambio('testo1'); return false">
    <font size="2">Clicca se vuoi inserire una nuova categoria</font></a></p>
    </div>



    <label>Descrizione
    <textarea name="textarea"></textarea>
    </label>
    </p>



    <label>
    <input type="submit" name="Submit" value="Invia" />
    </label>
    </p>
    <div id='testo1' style="border-left:0px dotted orange; border-right:0px dotted orange; border-bottom:0px dotted orange; width:390px; border-top: medium none; display:none; height:21px">
    <p align="right"><label><font size="2">inserisci una nuova categoria </font></label>
    <input type="text" name="categoria_suggerita" size="30"></p></p>
    </div>
    <input type="hidden" name="MM_insert" value="form1">
    <div>



    </form>
    </div></td>
    <td></td>
    </tr>
    <tr>
    <td>

    ATTENZIONE: IGNORATE I MESSAGGI D'ERRORE DOPO AVER PREMUTO SU TASTO &quot;INVIA&quot;. I DATI SARANNO REGISTRATI UGUALMENTE. </p>


    DOPO AVER REGISTRATO IL VOSTRO SITO CLICCATE QUI. IMPORTANTI ISTRUZIONI </p></td>
    <td> </td>
    </tr>
    </table>
    </body>
    </html>

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.