Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Adding Html Tags Using Php

(112 views • 3 replies)

This topic is 1 page long.

<< < > >>
None

azrag

Reply To Post Reply & Quote

Posted at: 8/6/07 10:23 PM

azrag NEUTRAL LEVEL 13

Sign-Up: 08/26/03

Posts: 1,132

ok I have a submit section im making for a lyrics site im creating. I want the data being submitted to the database to have html tags inputted before it goes into the database. I will give an example say someone is submitting the lyrics but they copy and paste these lyrics from some other site is it possible for everytime a new line is inputted can php input the <br> tag after the new line.

example (I copy and paste these lyrics and the NG BBS automatically makes the correct adjustments)

"fighting"
I said I'd moved on and I'd leave it alone,
But before I walk out there is something that I need you to know,
I got lost in the blink of an eye,
And I can never get back, no I never got back,
You were not there when I wanted to say,
That you were everything right and it wasn't you but me to change,
Now I got to go it alone,
But I'll never give up, no I'll never give up

What am I fighting for,
There must be something more,
For all these words I've said,
Do you feel anything

I said I'm OK but I know how to lie,
You were all that i had,
You were delicate and hard to find,
I got lost in the back of my mind,
And I can never get back, no I never got back
You were not there when I needed to say,
I hit the bottom so fast that my head was spinning 'round for days,
Now I gotta go it alone,
But I will never give up, no I'll never give up

What am I fighting for,
There must be something more,
For all these words I've said,
Do you feel anything

anyway any help with this will be greatly appreciated thanks

ITS OVER 9000!!!!!!!!!!! 8========D !!!!!!!!!!!!!!!! NIGG@H!!!!!!! MOAR RACISM!!!!!!!!!!!!!


None

heytherejake

Reply To Post Reply & Quote

Posted at: 8/6/07 11:23 PM

heytherejake NEUTRAL LEVEL 07

Sign-Up: 05/12/06

Posts: 141

Either in a MySQL database make the column a text (automatically adds line breaks, so when you submit it it stays like that), or use str_replace(",", ",<br>");

I don't cheat, I strategically maneuver

Proud AS 2 user!!!


None

azrag

Reply To Post Reply & Quote

Posted at: 8/6/07 11:35 PM

azrag NEUTRAL LEVEL 13

Sign-Up: 08/26/03

Posts: 1,132

thank you sir that function really helps now I have a better idea of how to go about my problem.

ITS OVER 9000!!!!!!!!!!! 8========D !!!!!!!!!!!!!!!! NIGG@H!!!!!!! MOAR RACISM!!!!!!!!!!!!!


None

authorblues

Reply To Post Reply & Quote

Posted at: 8/7/07 12:31 AM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,263

At 8/6/07 11:35 PM, azrag wrote: thank you sir that function really helps now I have a better idea of how to go about my problem.

php has a function called nl2br() for just such a problem. look it up.

my blog. smash code: 3523-1700-9216 [AUTHR]

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 03:28 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!