Hi im having some trouble with the code bellow. I would like for each time the form containing the name and message to be echoed out but in a table. So naturally i have made a for loop that checks the amount in the array and echo out seperate portions of the data in a table.
Please .. any help would be so apreciative
<?
//host form values in variables
$name = $HTTP_POST_VARS["name"];
$message = $HTTP_POST_VARS["message"];
$write = $name."|".$message."|";
//open the blog.txt
$fp = fopen("blogfile.txt","a+") or die("Counld not open file");
//writing to the file and closing
fwrite($fp, $write);
fclose($fp);
//split the variable $write at | making an array
$finished = explode('|',$write);
//count the entries in the blog
$amount = count($finished);
?>
<table bgcolor="#47607C" border="2" cellpadding="5" bordercolor="#003333" style="color:#003366;" width="500px">
<tr>
<td width=40><font color="#000000">Name</font></td>
<td width=200><font color="#000000">Message</font></td>
</tr>
<?php
for($i=0; $i<$amount ; $i = $i+2)
{
if(empty($finished[$i]) || $finished[$i] == null)
continue;
echo "<tr>";
echo "<td>".$finished[$i]."</td><td>".$finished[$i+1]."</td>";
echo "</tr>";
}
?>
</table>
The code in Bold is where i think the problem is.
Thanks