Reputation: 93
I'm guessing this is something you can do in PHP. What I want is to get the text in a textfield when the submit button is pressed and convert all the newlines into
<br>'s.
Help, please?
Upvotes: 1
Views: 251
Reputation: 5098
This illustrates it better:
$str = "This is a
multiline
string";
echo nl2br($str);
Upvotes: 0
Reputation: 237847
nl2br
would do what you want, I think.
<?php
$str = "\n\nfoo\nbar";
echo nl2br($str);
Output:
<br />
<br />
foo<br />
Upvotes: 5