/    Sign up×
Community /Pin to ProfileBookmark

Automatic <br> in text form.

I’m having a minor problem with the formatting of the text in a guestbook.
When I fill in the text and press enter for a row change, it doesn’t show in the final post. It only makes row changes if I actually write <br> in the textarea form.

[code=html]<textarea name=”comment” cols=”40″ rows=”5″ id=”comment” class=”textbox”></textarea>[/code]

[CODE]$sql=”INSERT INTO $tbl_name(name, email, comment, datetime)VALUES(‘$name’, ‘$email’, ‘$comment’, ‘$datetime’)”;
$result=mysql_query($sql);[/CODE]

[CODE]
<? echo $rows[‘comment’]; ?>[/CODE]

Anything that I need to add for those automatic row changes?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@furnissgJun 26.2008 — Try setting the wrap option to hard

[code=php]
<textarea name="comment" cols="40" rows="5" id="comment" class="textbox" wrap="hard"></textarea>
[/code]


more info on textarea can be found here
Copy linkTweet thisAlerts:
@QuidamauthorJun 26.2008 — Didn't work.

The formatting is ok in the database. But when you take the text from the database and export it to the field, it doesn't show.
Copy linkTweet thisAlerts:
@furnissgJun 26.2008 — are you showing the result back in a text area or just to screen? if it is the latter try

[code=php]

<? echo nl2br($rows['comment']); ?>

[/code]
Copy linkTweet thisAlerts:
@QuidamauthorJun 26.2008 — Worked like a charm.

Thanks alot. I really appriciate your help. ?
×

Success!

Help @Quidam spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...