Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: Non va a capo

  1. #1

    Non va a capo

    Ciao a tutti
    vorrei sapere come mai usando questo sistema per stampare a video un valore (sistema di dreamweaver) non mi va a capo, pur digitando in fase di inserimento del testo l'invio per andare a capo...

    Mi spiego meglio...

    io scrivo nel campo di testo questa frase scritta così:

    testo che viene inserito
    nel campo di testo
    in un file in php

    ma a video mi stampa la stessa frase ma così:

    testo che viene inserito nel campo di testo in un file in php

    cioè, in poche parole ignora il comando "a capo" (invio) e mi scrive la frase come se fosse su uno stesso rigo...

    da cosa dipende?

    lo script che uso per stampare a video è:
    codice:
    <?php echo $row_Recordset1['testo']; ?>
    grazie a tutti ciao
    La Gratitudine è la prima cosa nella vita...

    Grazie a tutti

  2. #2
    devi usare la funzione nl2br per convertire il \n usato per andare a capo nel codice html sorgente in


    se visualizzi il codice sorgente html vedrai che le righe vanno a capo

  3. #3
    ok, ma come devo intervenire sul codice che ho postato?

    da cosa dipende?

    grazie tante ciao
    La Gratitudine è la prima cosa nella vita...

    Grazie a tutti

  4. #4
    fai una ricerca sul forum...non sò quante volte se ne è parlato di questo argomento!

  5. #5

  6. #6
    ok, ma ammettiamo che il mio script sia questo:

    codice:
    <?php
    mysql_select_db($database_Prova, $Prova);
    $query_Recordset = "SELECT * FROM news";
    $Recordset = mysql_query($query_Recordset, $Prova) or die(mysql_error());
    $row_Recordset = mysql_fetch_assoc($Recordset);
    $totalRows_Recordset = mysql_num_rows($Recordset);
    ?>
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <?php echo $row_Recordset['id']; ?> <?php echo $row_Recordset['titolo']; ?> <?php echo $row_Recordset['testo']; ?> 
    </body>
    </html>
    <?php
    mysql_free_result($Recordset);
    ?>
    dove devo intervenire per risolvere il tutto

    Grazie tante per la pazienza... ciao
    La Gratitudine è la prima cosa nella vita...

    Grazie a tutti

  7. #7
    up
    La Gratitudine è la prima cosa nella vita...

    Grazie a tutti

  8. #8
    devi agire sull'inserimento, non sulla lettura

  9. #9
    l'inserimento è questo:
    codice:
    <?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 = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
    }
    
    if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Inserisci")) {
      $insertSQL = sprintf("INSERT INTO news (titolo, testo) VALUES (%s, %s)",
                           GetSQLValueString($HTTP_POST_VARS['Titolo'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['Testo'], "text"));
    
      mysql_select_db($database_Prova, $Prova);
      $Result1 = mysql_query($insertSQL, $Prova) or die(mysql_error());
    }
    
    mysql_select_db($database_Prova, $Prova);
    $query_Recordset1 = "SELECT * FROM news ORDER BY id DESC";
    $Recordset1 = mysql_query($query_Recordset1, $Prova) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
     <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form action="<?php echo $editFormAction; ?>" method="POST" name="Inserisci" id="Inserisci">
      
      
    
     
        <input name="Titolo" type="text" id="Titolo">
        <textarea name="Testo" wrap="VIRTUAL" id="Testo"></textarea>
        <input type="submit" name="Submit" value="Invia">
      </p>
      <input type="hidden" name="MM_insert" value="Inserisci">
    </form>
    </body>
    </html>
    grazie per l'aiuto
    La Gratitudine è la prima cosa nella vita...

    Grazie a tutti

  10. #10
    in fase di lettura però si può cmq agire con un explode!

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.