-3

In my code I have several sentences in one paragraph as I would like to not get spacing between them. However I can't seem to get them each to begin on a newline.

  <p class ="BasicP"> Datum: <?php echo $Datum;"\r\n"?>
    Betreft: <?php echo $Betreft;"<br>"?>
    Offertenr: <?php echo $Offertenr;"\n"?>
    <p>

And this outputs: Datum: Betreft: Offertenr:

I would like it to output:

Datum:

Betreft:

Offertenr:

Each of them starting on a new line.

I've tried <br>, PHP_EOL and newline.

If anyone could tell me what exactly is wrong and how to do it, that would be appreciated.

I added what I tried to the code, none of the tree get me a new line for some reason..

Kevin Bosman
  • 100
  • 11

1 Answers1

1

There are multiple options:

Sepperate paragraphs:

<p class ="BasicP">Datum: <?php echo $Datum;?></p>
<p class ="BasicP">Betreft: <?php echo $Betreft;?></p>
<p class ="BasicP">Offertenr: <?php echo $Offertenr;?></p>

Line break:

<p class ="BasicP">
    Datum: <?php echo $Datum;?><br/>
    Betreft: <?php echo $Betreft;?><br/>
    Offertenr: <?php echo $Offertenr;?>
<p>

Or print it as code:

<pre>
    Datum: <?php echo $Datum;?>
    Betreft: <?php echo $Betreft;?>
    Offertenr: <?php echo $Offertenr;?>
</pre>

This has noting to do with PHP. A simple HTML question.

Peon
  • 7,902
  • 7
  • 59
  • 100