|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
on a script that i wrote solely for myself (simple reminders script with content feed or whatnot lol), i was wondering how, when someone presses enter thus making a new line, the html code "br" or "p" can automatically be entered??
__________________
-Alexander |
|
#2
|
|||
|
|||
|
nl2br()
this will convert \r\n to <br> so when you hit enter it will replace that with <br> |
|
#3
|
|||
|
|||
|
where do i enter nl2br() ?
|
|
#4
|
|||
|
|||
|
when you submit the data, lets say from a textarea called test
echo nl2br($_POST['test']); This would print the variable with br tags |
|
#5
|
|||
|
|||
|
try this
function ReplaceStr($str) { $str = ereg_replace("\r\n", "<br>", $str); echo $str; } call this function like this ReplaceStr($myrow['textfield']);
__________________
regards, Fulton |
|
#6
|
|||
|
|||
|
dog, that does the exact same thing as nl2br, so why redifine a function that already exists?? The only difference between your function and nl2br, is that your functions echos the data, while nl2br returns the value. which just means you have to echo the function.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > auto-insert html "br" at end of line in database entries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|