Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Pages: [1]
Send this topic | Print
Topic: str_replace trouble  (Read 1640 times)
« on: February 25, 2005, 10:47:42 PM »
Senior Member
NOA_JOSH Offline
Senior Member
Member

View Profile WWW
***
Posts: 167



I'm close to finishing a script but I can't seem to be able to work the str_replace.

Anyways here is my code:

Code:

/*Begin Guestbook*/

$seperate ="
 ";
[b]$comments2 = str_replace($comments "\n"
);[/b]
$end ="

 ";
$data = "entry.gh";
$file = fopen($data, "a+");
fputs($file, ""); //Form Fields
fclose($file);
echo ("Thank You For Signing Our Guestbook");  //Thank You Message

/*End GuestBook*/
?>



What am I doing wrong?
Report to moderator   Logged


 
« Reply #1 on: February 25, 2005, 10:51:39 PM »
Moderator
Nick Offline
Moderator
Global Moderator
Newbie

View Profile WWW
*****
Posts: 8



You need to put in commas.

So, you should use:
Code:
$comments2 = str_replace($comments, "\n", "
");


or

Code:
$comments2 = nl2br($comments);
Report to moderator   Logged
« Reply #2 on: February 25, 2005, 11:01:16 PM »
Senior Member
NOA_JOSH Offline
Senior Member
Member

View Profile WWW
***
Posts: 167



Thank you Smiley
Report to moderator   Logged

 
Pages: [1]
Send this topic | Print
Jump to:  

Powered by SMF | SMF © 2006-2008, Simple Machines LLC