Page 1 of 1

What's wrong with my code?

Posted: Mon Apr 25, 2005 7:07 pm
by rayquazadude
I need help, when I try to run this code it says "
Parse error: parse error, unexpected T_VARIABLE in /home/vhosts/www.rayquazalair.net/postingupdate.php on line 35"
What's wrong and how do I fix it? Here's the code:

Code: Select all

<?php 
$isusernamevalid = $_POST['isusernamevalid'];
$username = $_POST['username'];
$date = $_POST['date'];
$content = $_POST['content'];
$avatarpath = $_POST['avatarpath'];
$title = $_POST['title'];
$table = <<<EOT
<br>
<br>
<br>
<br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%">
<tr>
<td width="100%" height="12" background="newstitlebg.png">
<font size="1" face="Tahoma" color="#FFFFFF">$title - Posted By $username on $date </font>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#004400"><p align="justify">
<img src="$avatarpath" align="left">$content</p>
<p align="center">-$username-</p>
</td>
</tr>
</table>
EOT;
$filename = "updates.txt"
$handle = fopen($filename, "wb");
    $numbytes = fwrite($handle, $table);
if ($isusernamevalid == valid) {
    fclose($handle);
    print "Update was posted successfully. $numbytes bytes posted.\n";
} else {
print "Update was not posted successfully.\n";
}
print "Click <a href=\"index2.php\">Here</a> to go to the main page";
  ?>
d11wtq | Please read the sticky about posting code in the forums :idea:

Posted: Mon Apr 25, 2005 7:14 pm
by Chris Corbyn
Line 26 in your code here....

Code: Select all

EOT;$filename = &quote;updates.txt&quote;
Missing the semi-colon after the string

Code: Select all

EOT;$filename = &quote;updates.txt&quote;;
:D

Welcome to the forums rayquazadude!

Posted: Mon Apr 25, 2005 7:16 pm
by rayquazadude
ok, thanks!

RE

Posted: Mon Apr 25, 2005 8:27 pm
by harrisonad
I recommend you use Activestate Komodo PHP Editor. it highlights the syntax errors in your code.