![]() |
A Quick PHP Question...
I need to combine some strings and send them to a page with a multi-line form field in it (hope that makes sense). In itself this is simple and so's the problem...
I want to insert a line break betweek each bit of data (it's an address field and I want each piece on its own line). How to do it? Obviously being an form field <br \> won't work so what do I use? Is there an escape character? for example I want: $ addressfield = $ street . (new line) . $ city . (newline) etc I figure someone here must know how to do something so simple. It's such a daft thing to not know how to do that finding how is proving impossible. |
$addressfield = $street . '\n' . $city . '\n' . $etc;
|
I think this is what you are looking for, or at least close.
http://us2.php.net/manual/en/function.nl2br.php |
use "\n\r" or "\r"
not sure. :) |
Quote:
Code:
function br2nl($text) { |
a newline char is \r in a multiline textfield like textarea .
|
try this
$addressfield = $street . "\r" . $city . "\r"; |
\n wasn't working for some odd reason. Hmmm...thanks for the replies. I'll try combining it with r as suggested :)
|
That did it - \r :)
|
Quote:
You are welcome :thumbsup |
Quote:
You'd be amazed how hard it is to find that little bit of info. I found quite a few pages listings various escape characters etc that missed out the /r. Oh well - now I know and won;t forget. Thanks again :) |
All times are GMT -7. The time now is 06:28 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123