I want to have a form that the user fills out to submit data to a text file. Sort of like a news script, but customized.
The form action="submitrants.php" is:
<form action="rantssubmit.php" method="post">
<table width="75%" border="0">
<tr>
<td valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Name:</strong></font><br>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Title:</strong></font>
<br> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Description:</strong></font>
<br> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message:</strong></font>
<br> <br> <br> <br> <br> <br> <br> </td>
<td valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="name" type="text" size="30">
<BR>
<input name="title" type="text" size="30">
<BR>
<input name="description" type="text" size="40">
<br>
<textarea name="message" cols="70" rows="5"></textarea>
<br>
<input name="submit" type="submit" value="Submit">
</font></td>
</tr>
</table>
</form>
The script to write to rants.txt called submitrants.php is:
<?php
$filename = 'rants.txt';
$handle = fopen ($filename, 'r+');
$name = $_POST["name"];
$title = $_POST["title"];
$message = $_POST["message"];
$description = $_POST["description"];
$table = " <TABLE width="556" border="1" cellpadding="0" cellspacing="0" bordercolor="black"><TR bordercolor="white"
align="top"><TD width="556" bordercolor="#000099" bgcolor="#000066"><B><center><font color="#FFFFFF" size="1">$title -
written by: $name</font></center></B></TD></TR><TR bordercolor="black" align="top"> <TD bgcolor="black"></TD></TR><TR
bordercolor="white"><TD align="center" valign="top" bordercolor="#000099" bgcolor="#000033"><font
size="1">$description;</font></TD></TR></TABLE> ";
$entry = $table;
fwrite($handle, $entry);
fclose($handle);
?>
Then on the page I want it to show is:
<?php include ("right.txt"); ?>
The error I get after I push Submit is:
Parse error: parse error, unexpected T_LNUMBER in rantssubmit.php on line 9
I'm sure there is something wrong where I define what $table is. All the code there is to build a table that has the name and title in the top row, and the description in the bottom row. Please help? How can I make this work?