Domanda

My <input> tag is printing <br /> instead of actually producing linebreaks? I have a feeling it is something simple I have overlooked...

I should not that the $bio variable is being called from MySQL database, and is set to 'longtext'
(I suspect this might be playing a factor)

 <form>
<input 
style="position:relative;left:10px;min-height:270px;width:40%;border:solid 2px black;top:20px;"
type="text" 
name="bio" 
value ="<?php echo nl2br($bio);?>"
readonly="readonly" 
/>
 </form>

The output does in-fact show <br/>

however my php does't seem to be converting it to actual line breaks.

Could anyone think of a reason this would be happening? (the only thing I thought of was checking for htmlspecialchars(), but there is none for the $bio variable.

Thanks!!

È stato utile?

Soluzione

In regular input tags the browser won't display new line chars.

You could use textarea if you need to display editable text.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top