Insert New line in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ruchi choudhary
    New Member
    • Nov 2012
    • 22

    #1

    Insert New line in php

    Hello

    Actually I m just a beginner in php so I m facing very basic problems.So can u help me how to insert a new line in php?
    Through search I found that "\n" is for new line character, but applying to my code its not working.

    Here is my code:
    Code:
    <?php
    error_reporting (E_ALL ^ E_NOTICE);
    $con = mysql_connect("localhost","root","");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("genomics", $con);
       
    $Accession = $_GET['Accession'];
    $Locus = $_GET['Locus'];
    $Definition = $_GET['Definition'];
    $Sequencetype = $_GET['Sequencetype'];
    $Sequencelength = $_GET['Sequencelength'];
    $Version = $_GET['Version'];
    $GI = $_GET['GI'];
    $Organism = $_GET['Organism'];
    $Authors = $_GET['Authors'];
    $Publication = $_GET['Publication'];
    $Labaddress = $_GET['Labaddress'];
    $Dateofsequencesubmission = $_GET['Dateofsequencesubmission'];
    $collabrationown = $_GET['collabrationown'];
    $result = mysql_query("SELECT * FROM maintable WHERE Accession = '$Accession'");
    
    while($row = mysql_fetch_array($result))
    {
    echo "Accession <input type='text' name='Accession' value='".$row['Accession']."'>";
    echo "Locus <input type='text' name='Locus' value='".$row['Locus']."'>";
    echo "Sequence length <input type='int' name='Sequencelength' value='".$row['Sequencelength']."'>";
    echo "Sequence type <input type='text' name='Sequencetype' value='".$row['Sequencetype']."'>";
    }
    
    mysql_close($con);
    ?>
    Last edited by zmbd; Nov 26 '12, 02:29 PM. Reason: [Z{Please use the <CODE/> format button in the toolbar to format posted Code/SQL}]
  • phpmagesh
    New Member
    • Nov 2008
    • 119

    #2
    Try using <br> next to input box

    Code:
    echo "Sequence type <input type='text' name='Sequencetype' value='".$row['Sequencetype']."'><br/>";
    Last edited by zmbd; Nov 26 '12, 02:29 PM. Reason: [Z{Please use the <CODE/> format button in the toolbar to format posted Code/SQL}]

    Comment

    • Ruchi choudhary
      New Member
      • Nov 2012
      • 22

      #3
      Thank You so much......but for insert a new line between Accession and locus.........w hat should I do???

      Comment

      • phpmagesh
        New Member
        • Nov 2008
        • 119

        #4
        Hope this will do for you.

        Code:
        echo "Accession <input type='text' name='Accession' value='".$row['Accession']."'><br/>";
        echo "Locus <input type='text' name='Locus' value='".$row['Locus']."'><br/>";
        echo "Sequence length <input type='int' name='Sequencelength' value='".$row['Sequencelength']."'><br/>";
        echo "Sequence type <input type='text' name='Sequencetype' value='".$row['Sequencetype']."'><br/>";
        output as:

        Code:
        Accession <input box>
        Locus <input box>
        Sequence length <input box>
        Sequence type <input box>
        Technically <br /> plays same role in browser as "\n".

        To know more about <BR> Tag (HTML). Follow this link



        Thanks,
        Last edited by zmbd; Nov 26 '12, 02:29 PM. Reason: [Z{Please use the <CODE/> format button in the toolbar to format posted Code/SQL}]

        Comment

        Working...