"Parse error: syntax error, unexpected T_VARIABLE" Error

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
Timpano
Forum Newbie
Posts: 5
Joined: Thu Feb 12, 2009 4:11 pm

"Parse error: syntax error, unexpected T_VARIABLE" Error

Post by Timpano »

I keep on getting this error and am not able to rectify it. It always comes up on line 22.
Attachments
snapshot.jpg
snapshot.jpg (30.18 KiB) Viewed 97 times
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: "Parse error: syntax error, unexpected T_VARIABLE" Error

Post by susrisha »

to be frank i dont find any errors in the code that has been presented. Can you post us some more code please
Timpano
Forum Newbie
Posts: 5
Joined: Thu Feb 12, 2009 4:11 pm

Re: "Parse error: syntax error, unexpected T_VARIABLE" Error

Post by Timpano »

This is all the code for the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Queen of Hearts - Viewing Options</title>


<link href="trailers/queen/basic.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
body {
background-color: #FEFEFE;
}
-->
</style>
<!-- Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved. -->
</head>

<body><?php    
$key='jack'; //the bold is your password/code needed to download
    $pw=$_POST['password']; //this takes the content from the password field and stores it as a variable called 'pw'

//The following sets up a condition which compares the field to your set password and displays the relevant content

    if($pw=$key) { ?>
<div align="center"><br />
</div>
<table width="1024" height="684" border="0" align="center" cellpadding="0" cellspacing="0" background="trailers/queen/images/queen_index_bkgd.jpg">
<tr>
<td background="trailers/queen/images/queen_view_bkgd.jpg" scope="col"><table width="1024" border="0" cellpadding="0" cellspacing="0" background="images/queen_view_bkgd.jpg">
<tr>
<td width="81" height="264" scope="row">&nbsp;</td>
<td width="385" height="264">&nbsp;</td>
<td width="76" height="264">&nbsp;</td>
<td width="391" height="264">&nbsp;</td>
<td width="91" height="264">&nbsp;</td>
</tr>
<tr>
<td width="81" scope="row">&nbsp;</td>
<td width="385" height="130"><img src="images/spacer.gif" width="384" height="129" border="0" usemap="#Map" /></td>
<td width="76" height="130">&nbsp;</td>
<td width="391" height="130"><img src="images/spacer.gif" width="390" height="129" border="0" usemap="#Map2" /></td>
<td width="91" height="130">&nbsp;</td>
</tr>
<tr>
<td width="81" height="290" scope="row">&nbsp;</td>
<td width="385" height="290">&nbsp;</td>
<td width="76" height="290">&nbsp;</td>
<td width="391" height="290">&nbsp;</td>
<td width="91" height="290">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<br />

<map name="Map" id="Map"><area shape="rect" coords="3,4,380,125" href="#" /></map>
<map name="Map2" id="Map2"><area shape="rect" coords="3,2,387,126" href="#" /></map></body>
</html>
       
    <?php }else{ ?>

    <?php } ?>
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: "Parse error: syntax error, unexpected T_VARIABLE" Error

Post by Mark Baker »

Can't see the error in question but

Code: Select all

if($pw=$key)
should be

Code: Select all

if($pw==$key)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: "Parse error: syntax error, unexpected T_VARIABLE" Error

Post by Eran »

what version of php are you running?
Timpano
Forum Newbie
Posts: 5
Joined: Thu Feb 12, 2009 4:11 pm

Re: "Parse error: syntax error, unexpected T_VARIABLE" Error

Post by Timpano »

I'm quite new at this. I am using Dreamweaver cs3 on a mac osx 10.5.6. I think it is PHP5
Post Reply