A
Anonymous
Guest
Hi gang!
First of all, I have read everything I can find on these procedures, but they all say the same thing... re: 'opening, writing to a file and then closing the file. Unfortunately, they don't say what file types can be written with this method. All the examples I have found ONLY write to text (*.txt) files. I'm trying to do something a little different. Maybe I'm going about it the wrong way... I'm not sure. But, here it is:::
:help:
I'm trying to make a simple PHP guestbook that will write table rows to an HTML page instead of a TEXT file. I'm using a php to do the <table>... header, an include of the following file's output, and then the </table> footers.
Here's the PHP I'm having trouble with.
In theory, it should work perfectly. It is really not writing to the file at all.
Am I going about this in the right way? Am I missing something, here? Can the same thing be accomplished more efficiently?
ANY help you can give me would be GREATLY appreciated as this is really confusing & I don't want to resort to using a text file with the guestbook.
Thank you in advance & take care,
B.
First of all, I have read everything I can find on these procedures, but they all say the same thing... re: 'opening, writing to a file and then closing the file. Unfortunately, they don't say what file types can be written with this method. All the examples I have found ONLY write to text (*.txt) files. I'm trying to do something a little different. Maybe I'm going about it the wrong way... I'm not sure. But, here it is:::
:help:
I'm trying to make a simple PHP guestbook that will write table rows to an HTML page instead of a TEXT file. I'm using a php to do the <table>... header, an include of the following file's output, and then the </table> footers.
Here's the PHP I'm having trouble with.
Code:
<?
$todaysDate=date("l, M jS, Y");
$todaysTime=date("g:i:s A - T");
$carriageReturn = "<br>";
$recordNumber = $recordNumber +1;
// Opens read.html file for writing.
$FilePointer=@fopen(read.html,"a");
// Creates record
$message = "<tr><br>";
$message .= "<td>Record Number</td><br>";
$message .= "<td>$recordNumber</td><br>";
$message .= "</tr><br>";
$message .= "<tr><br>";
$message .= "<td>Date: $todaysDate</td><br>";
$message .= "<td>Time: $todaysTime</td><br>";
$message .= "</tr><br>";
$message .= "<tr><br>";
$message .= "<td colspan=2>Name: $writerName (<a href=\"mailto:$writerEmail?subject=Guestbook Question or Comment:\">$writerEmail</a>)</td><br>";
$message .= "</tr><br>";
$message .= "<tr><br>";
$message .= "<td colspan=2>Message: $writerMessage</td><br>";
$message .= "</tr><br>";
$message .= "<tr>";
$message .= "<td colspan=2><hr color=#C0C0C0></td><br>";
$message .= "</tr><br>";
// writes record to read.html file
@fwrite($FilePointer,$message);
// closes read.html file
@fclose($FilePointer);
// send email to us telling who and what was written to the guestbook for safety.
$mailto = "me@mydomain.com";
$subject = "I have just written to the guestbook!";
mail($mailto, $subject, $writerMessage, "From: $writerEmail\r\n" . "Reply-To: $writerEmail\r\n");
print ("Thank you for your submission!<br>
<br>
Your comments are <b>VITAL</b> to making this site better!<br>
");
?>
In theory, it should work perfectly. It is really not writing to the file at all.
Am I going about this in the right way? Am I missing something, here? Can the same thing be accomplished more efficiently?
ANY help you can give me would be GREATLY appreciated as this is really confusing & I don't want to resort to using a text file with the guestbook.
Thank you in advance & take care,
B.