LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2004, 11:19 AM   #1
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
php guestbook


hello!

i wrote a guestbook in php that uses a mysql database. as a i don't know how to fix a thing:
when someone writes a post in it, maybe he clicks the enter-button to make a new line or more times to have more blank lines. but this will not happen...only if there will be introduced a "<br> tab" directly in the post. but that's not fun, and the most poster don't even know what's that a br-tab.

an example, if i want to have this message:
-----------------------------------------------------------
Hello,
this a guestbook entry!


Bye!

-----------------------------------------------------------

entries in my guestbook should be written this way if i want them to look like the above:
Code:
Hello,
<br> 
this a guestbook entry!
<br>
<br>
<br>
Bye!
Can you help me fix that?

Thank you!

Boby
 
Old 06-21-2004, 11:50 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
PHP Code:
$message "Hello,
this a guestbook entry!


Bye!"
;
$message str_replace"\n""\n<BR>"$message );
echo 
$message 
 
Old 06-21-2004, 01:17 PM   #3
Boby
Member
 
Registered: Feb 2004
Posts: 781

Original Poster
Rep: Reputation: Disabled
ok, thanX. that worked!

Boby
 
Old 06-21-2004, 01:58 PM   #4
gamehack
Member
 
Registered: Jun 2003
Location: Sevenoaks, UK
Distribution: Ubuntu
Posts: 183

Rep: Reputation: 30
You can also use
PHP Code:
$msg 'this 
is 
the message'
;
echo 
nl2br($msg); 
This makes the same thing.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a guestbook k1ll3r_x Linux - Software 16 07-09-2005 05:04 PM
PHP Guestbook Linuxidiot Programming 1 04-17-2005 09:53 AM
Guestbook POST erros matt3333 Programming 2 05-13-2003 12:24 AM
How to get date in guestbook (php) CurlyMo Programming 1 02-10-2003 06:32 AM
CGI guestbook cant see form amp2000 Programming 2 10-31-2001 01:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration