PDA

View Full Version : PHP gBook script



joso
July 13th, 2003, 11:12 AM
Hey, this is for a PHP gBook, i'm really crap when it comes to PHP scripts, anyone know this keeps saying Parse Error on line 21 ?(whats the one with the date bit on)....


<?php
if ($message != '')
{
$message = str_replace ("\n","<br>",$message);
$message = strip_tags ($message, '<br>');

$newRow = '<div class="viewGuestbook">' . '<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">'. strip_tags ($name) .'</td>
</tr>
<tr>
<td align="left" valign="top"></td>
</tr>' .
'<tr>
<td align="left" valign="top">'. ($message) .'</td>
</tr>
<tr>
<td align="left" valign="top"></td>
</tr>'
'<tr>
<td align="right" valign="top">'. date('d.m.Y') .'</td>
</tr>
</table></div>';

$oldRows = join ('', file ('guestbook.txt') );
$fileName = fopen ('guestbook.txt', 'w');
fputs ($fileName, $newRow . chr(13) . chr(10) . $oldRows);
fclose ($fileName);
}

include ("guestbook.php");
?>

Jubba
July 13th, 2003, 01:16 PM
when you are printing something and you need to have quotes then you have to do \"

somehting like

<td align=\"right\">

eyezberg
July 13th, 2003, 06:27 PM
Not really, depends on the quotes, ' is not like "..
but check this:



<td align="left" valign="top"></td>
</tr>' .
'<tr>
<td align="left" valign="top">'. ($message) .'</td>
</tr>
<tr>
<td align="left" valign="top"></td>
</tr>'
'<tr>

you forgot the . in the second bolded part to concatenate it!

Jubba
July 14th, 2003, 01:40 AM
doh! it took my slashes out... stupid php... yeah thats true too .... just not the way I go about it...