What's wrong with my code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rayquazadude
Forum Newbie
Posts: 3
Joined: Mon Apr 25, 2005 6:58 pm

What's wrong with my code?

Post 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:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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!
rayquazadude
Forum Newbie
Posts: 3
Joined: Mon Apr 25, 2005 6:58 pm

Post by rayquazadude »

ok, thanks!
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

RE

Post by harrisonad »

I recommend you use Activestate Komodo PHP Editor. it highlights the syntax errors in your code.
Post Reply