how to reformat text information from webform add return enter between lines
RegisterLogin
how to reformat text information from webform add return enter between lines
Post Description: how to reformat text information from webform add return enter between lines
Tags: how, to, reformat, text, information, from, webform, add, return, enter, between, lines
This Post Was Posted On Feb 29, 2008 By web hosting #1284
Post Description: how to reformat text information from webform add return enter between lines
Tags: how, to, reformat, text, information, from, webform, add, return, enter, between, lines
This Post Was Posted On Feb 29, 2008 By web hosting #1284
how to reformat text information from webform add return enter between lines by web hosting
for example lets say i entered this information on my form textarea:
INPUT
wallpaperama is cool
this is the second line
and this is the fourth line
this is the second line
and this is the fourth line
so when i get the information from my database and i display it on my web page, is shows like this:
OUTPUT
wallpaperama is cool this is the second line and this is the fourth line
as you can see, its a long continous line and that's not how it was entered, i want to show it as the user entered it. so how do you do it.. simple
i created a function or a class you can use to format the text so that it will show exactly as it was entered into the form
PHP FUCNTION:
function form_txt($text){
$text = str_replace("n", '<br>',$text);
return $text;
}
lets say my datbase field is called content
so using the function above i can clean up by using this code:
CODE:
echo form_txt($content);
so once i do that it will display my content as this:
wallpaperama is cool
this is the second line
and this is the fourth line
this is the second line
and this is the fourth line
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2012 Webune Forums - Mon Dec 17, 2012 9:57 pm
Powered by: Webune Forums V3
Powered by: Webune Forums V3