• Super User

    Posta il codice php! 🙂
    Comunque probabilmente quel messaggio potrebbe significare che hai messo un header(),nonostante fosse già presente sottoforma di codice HTML


  • User Attivo

    Questo il codice del form per l'inserimento dei dati:

    <?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>
    <p>
    <label>Indirizzo
    <input type="text" name="textfield2" />
    </label>
    </p>
    <p>
    <label>Email
    <input type="text" name="textfield3" />
    </label>
    </p>
    <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>
    <p>
    <label>Descrizione
    <textarea name="textarea"></textarea>
    </label>
    </p>
    <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>&nbsp;</td>
    

    </tr>
    <tr>
    <td><p>ATTENZIONE: IGNORATE I MESSAGGI D'ERRORE DOPO AVER PREMUTO SU TASTO "INVIA". I DATI SARANNO REGISTRATI UGUALMENTE. </p>
    <p>DOPO AVER REGISTRATO IL VOSTRO SITO <a href="<A href="http://www.commercialevirtuale.com/reg_ok.htm">CLICCATE">http://www.commercialevirtuale.com/reg_ok.htm">CLICCATE QUI</a>. IMPORTANTI ISTRUZIONI </p></td>
    <td> </td>
    </tr>
    </table>
    </body>
    </html>


  • Super User

    [php]<?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());
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    echo"
    <script type='text/javascript'>
    <!--
    function doRedirect() {
    location.href = 'http:://www.commercialevirtuale.com/reg_ok.htm';
    }
    window.setTimeout('doRedirect()', 0);
    //-->
    </script>
    ";}?><!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>
    <p>
    <label>Indirizzo
    <input type="text" name="textfield2" />
    </label>
    </p>
    <p>
    <label>Email
    <input type="text" name="textfield3" />
    </label>
    </p>
    <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>
    <p>
    <label>Descrizione
    <textarea name="textarea"></textarea>
    </label>
    </p>
    <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>&nbsp;</td>
    

    </tr>
    <tr>
    <td><p>ATTENZIONE: IGNORATE I MESSAGGI D'ERRORE DOPO AVER PREMUTO SU TASTO "INVIA". I DATI SARANNO REGISTRATI UGUALMENTE. </p>
    <p>DOPO AVER REGISTRATO IL VOSTRO SITO <A href="http://www.commercialevirtuale.com/reg_ok.htm">CLICCATE QUI</a>. IMPORTANTI ISTRUZIONI </p></td>
    <td> </td>
    </tr>
    </table>
    </body>
    </html>[/php]


  • User Attivo

    adesso provo.


  • User Attivo

    niente non va,
    dop aver cliccato su invia, mi da pagina bianca e i dati non vengono salvati.


  • User Attivo

    qualcun'altro che possa aiutarmi?


  • Super User

    Potresti settare nel codice php un campo "hidden" che verifica se il form è stato clicckato.
    Se non è così,lo script mostra il codice html della pagina.
    Così facendo non avresti problemi con gli headers.


  • User Attivo

    <?php virtual('/Connections/symbio.php'); ?>

    C'è solo php dentro? Perchè usi virtual e non require o include? non è che questa riga stampa qualcosa?


  • User Attivo

    non so.

    fa tutto dreamwaver.


  • User Attivo

    prova ad aprire quel file e guarda il codice, vedi se stampa qualcosa. In caso postalo che lo vediamo insieme


  • User Attivo

    intendi Connections/symbio.php' ?

    eccolo:

    <?php

    FileName="Connection_php_mysql.htm"

    Type="MYSQL"

    HTTP="true"

    $hostname_symbio = "localhost";
    $database_symbio = "xxx";
    $username_symbio = "xxx";
    $password_symbio = "xxx";
    $symbio = mysql_pconnect($hostname_symbio, $username_symbio, $password_symbio) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>

    ovviamente ho cambiato i dati.