"Parse error: syntax error, unexpected T_VARIABLE" Error
Moderator: General Moderators
"Parse error: syntax error, unexpected T_VARIABLE" Error
I keep on getting this error and am not able to rectify it. It always comes up on line 22.
- Attachments
-
- snapshot.jpg (30.18 KiB) Viewed 97 times
Re: "Parse error: syntax error, unexpected T_VARIABLE" Error
to be frank i dont find any errors in the code that has been presented. Can you post us some more code please
Re: "Parse error: syntax error, unexpected T_VARIABLE" Error
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"> </td>
<td width="385" height="264"> </td>
<td width="76" height="264"> </td>
<td width="391" height="264"> </td>
<td width="91" height="264"> </td>
</tr>
<tr>
<td width="81" scope="row"> </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"> </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"> </td>
</tr>
<tr>
<td width="81" height="290" scope="row"> </td>
<td width="385" height="290"> </td>
<td width="76" height="290"> </td>
<td width="391" height="290"> </td>
<td width="91" height="290"> </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 } ?>
<!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"> </td>
<td width="385" height="264"> </td>
<td width="76" height="264"> </td>
<td width="391" height="264"> </td>
<td width="91" height="264"> </td>
</tr>
<tr>
<td width="81" scope="row"> </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"> </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"> </td>
</tr>
<tr>
<td width="81" height="290" scope="row"> </td>
<td width="385" height="290"> </td>
<td width="76" height="290"> </td>
<td width="391" height="290"> </td>
<td width="91" height="290"> </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
Can't see the error in question but should be
Code: Select all
if($pw=$key)Code: Select all
if($pw==$key)Re: "Parse error: syntax error, unexpected T_VARIABLE" Error
what version of php are you running?
Re: "Parse error: syntax error, unexpected T_VARIABLE" Error
I'm quite new at this. I am using Dreamweaver cs3 on a mac osx 10.5.6. I think it is PHP5