문제

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!!

도움이 되었습니까?

해결책

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top