PHP Question

They have: 324 posts

Joined: Dec 1999

Hi,
I am writing a PHP/mySQL script for my web site. It lets be add articles from a browser etc.

If I want a line break, I have to put in the BR tag. I think there is a way to put in a little code so if you just hit enter like:

some article text goes here
some article text goes here
some article text goes here
<ENTER> (you wouldn't type enter, you would hit enter, so there is a white space)

text here.

Does anybody get what I mean?

Thanks!

------------------
TWF Moderator
Visit the Affiliate or Associate Programs

They have: 324 posts

Joined: Dec 1999

I know they do this in message board software like vBulletin Smiling

They have: 58 posts

Joined: Jul 2000

I don't follow, explain more please.

They have: 16 posts

Joined: Jun 2000

I think he is saying that he is making a script so people can fill in a form to submit articles and he wants them to be able to submit them without having to use HTML. He wants the script to auto format the text so for example when they want to move onto a new line the just press [enter] and they don't have to type

You may not realise it but boards like UBB and VB use this so your text is displayed as you type it. You don't need to use code (except vBcode in some cases) to format simple messages.

I don't know if I have explained what he wants any better than he did already. I cannot help you, Matt, I am only a learner like you. I'm just beginning to get to grips with the basics.

Gem
S I F O X - Giving The Internet A Makeover

They have: 324 posts

Joined: Dec 1999

Yeah, that is just about what I want....Maybe I can find where they do it in vBulletin or ask a developer

He has: 424 posts

Joined: Mar 1999

Matt,

What you are looking for is a supported feature of PHP (and one I have come to know well).

You want the nl2br() command.

What this command does is take new lines (hence the "nl") and changes them to the new line html code.

Use: $new_string = nl2br($string_to_change);

Hope that helped.

They have: 324 posts

Joined: Dec 1999

Thanks a lot! Smiling

They have: 324 posts

Joined: Dec 1999

If anybody else would like more information on this, take a look at http://www.php.net/manual/function.nl2br.php for more information...

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.