user3162341
user3162341

Reputation: 251

Texterea no space is written with space

I have a texterea, i wrote "1" without space.

My goal : I want to show the value of $data['CMD_COM_LIV'] if

The problem : You can see this picture i have a little space between the beginning of the texterea and "1".

I tried to use n12br and i got the same result.

In PHPMYADMIN, CMD_COM_LIV is in UT8_general_ci, NULL and text and the value doesn't have any space...

It's only when i want to show the result in the texterea.

Thanks.

enter image description here

<div style="margin-top:15px;">
  <label>Commande :</label><br />
  <textarea rows="5" cols="60" name="com_cmd">
  <?php if(!empty($data['CMD_COM_COM'])) { echo nl2br($data['CMD_COM_COM']);} ?></textarea>
  <div class="clear"></div><br />

  <label>Livraison :</label><br />
  <textarea rows="5" cols="60" name="com_liv">
  <?php if(!empty($data['CMD_COM_LIV'])) { echo $data['CMD_COM_LIV']; }?></textarea>
  <div class="clear"></div><br />

  <label>Facturation :</label><br />
  <textarea rows="5" cols="60" name="com_fact">
  <?php if(!empty($data['CMD_COM_FACT'])) { echo $data['CMD_COM_FACT']; }?></textarea>
</div>

 

Upvotes: 1

Views: 75

Answers (2)

Arian Faurtosh
Arian Faurtosh

Reputation: 18521

You have to remove the white space between your <textarea> ... <?php tag. Like this:

<div style="margin-top:15px;">
  <label>Commande :</label><br />
  <textarea rows="5" cols="60" name="com_cmd"><?php if(!empty($data['CMD_COM_COM'])) { echo nl2br($data['CMD_COM_COM']);} ?></textarea>
  <div class="clear"></div><br />

  <label>Livraison :</label><br />
  <textarea rows="5" cols="60" name="com_liv"><?php if(!empty($data['CMD_COM_LIV'])) { echo $data['CMD_COM_LIV']; }?></textarea>
  <div class="clear"></div><br />

  <label>Facturation :</label><br />
  <textarea rows="5" cols="60" name="com_fact"><?php if(!empty($data['CMD_COM_FACT'])) { echo $data['CMD_COM_FACT']; }?></textarea>
</div>

Upvotes: 0

Lee
Lee

Reputation: 10603

Any white space between the tags which is NOT inside php tags, remains white space in the resulting html output.

Remove any whitespace/newlines between your textarea tags, and it will stop outputting the space

Upvotes: 3

Related Questions