I have a code and it comes up with this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/a9617139/public_html/order2.php on line 1

I don't know why it does. This is my code for that page:

<?php
session_start();
?>
<script language="JavaScript" type="text/javascript"><!--
	function placeFocus() {
	  if (document.forms.length > 0) {
		  var field = document.forms[0];
		  for (i = 0; i < field.length; i++) {
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
				document.forms[0].elements[i].focus();
				break;
             }
          }
       }
	}
// -->
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
  <title>Steve's web design - Good quality websites from £50!</title>
  <meta content="Evrsoft First Page" name="GENERATOR">
  <link href="style.css" type="text/css" rel="STYLESHEET">

</head>

<body onload="placeFocus();">
<?php
if (isset($_SERVER["PHP_SELF"]))
	$sThisScript = $_SERVER["PHP_SELF"];
elseif (isset($HTTP_SERVER_VARS["PHP_SELF"]))
	$sThisScript = $HTTP_SERVER_VARS["PHP_SELF"];
else
    die("No PHP_SELF defined");

$bCompare = false;
if (isset($_POST["compare"]))
    $bCompare = true;
elseif (isset($HTTP_POST_VARS["compare"]))
    $bCompare = true;

if ($bCompare)
{
    if (isset($_SESSION["VerifyImgString"]))
        $sVerifyImgString = $_SESSION["VerifyImgString"];
    elseif (isset($HTTP_SESSION_VARS["VerifyImgString"]))
        $sVerifyImgString = $HTTP_SESSION_VARS["VerifyImgString"];
	else
		die("No VerifyImgString found in session");
	if (isset($_POST["verify_input"]))
		$sInput = $_POST["verify_input"];
	elseif (isset($HTTP_POST_VARS["verify_input"]))
		$sInput = $HTTP_POST_VARS["verify_input"];
	else
		die("No input found");
	if ($sVerifyImgString === $sInput){
		echo "<p>Your input was correct!</p>";}
	else {
		echo "<p>Your input did not match the image.</p>";
	echo "<p><a href=\"$sThisScript\">Try again</a>.</p>";
}

?>
  <table cellspacing="0" cellpadding="0" width="798" align="center" border="0">
    <tbody>
      <tr>
        <td height="122"><img class="banner" height="136" src="images/top%20banner2.png" width="798"></td>
      </tr>
    </tbody>
  </table>

  <table cellspacing="0" cellpadding="0" width="798" align="center" border="0">
    <tbody>
      <tr>
        <td width="7" background="images/menu%20back.jpg" height="467">&nbsp;</td>

        <td valign="top" width="136" bgcolor="#DDDDDD" height="467">
          <table cellspacing="0" cellpadding="0" width="136" border="0">
            <tbody>
              <tr>
                <td height="50"></td>
              </tr>

              <tr>
                <td height="30"><img src="images/menuheader.gif"></td>
              </tr>

              <tr height="40">
                <td class="nav" onclick="document.location.href='index.htm';">
                  <p align="center">Home</p>
                </td>
              </tr>

              <tr height="40">
                <td class="nav" onclick="document.location.href='portfolio.htm';">
                  <p align="center">Portfolio</p>
                </td>
              </tr>

              <tr height="40">
                <td class="nav" onclick="document.location.href='about.htm';">
                  <p align="center">About</p>
                </td>
              </tr>

              <tr height="40">
                <td class="navcurrent">
                  <p align="center">Order</p>
                </td>
              </tr>

              <tr height="40">
                <td class="nav2" onclick="document.location.href='contact.htm';">
                  <p align="center">Contact</p>
                </td>
              </tr>

              <tr>
                <td height="40"></td>
              </tr>

              <tr>
                <td></td>
              </tr>
            </tbody>
          </table><br>
        </td>

        <td width="7" background="images/menu%20back.jpg" height="467">&nbsp;</td>

        <td class="main" valign="top">
          <br>

          <p>We will design and make&nbsp;the homepage of your website for free to give you a taster of our services.</p>

          <p>You will then be e-mailed with additional information on how to carry out the order for the whole website. Once purchased you will be able to have full contact through email&nbsp;and
          updated previews through our website to show you how the website is getting along. Therefore you may change and customize it to your liking.</p>

          <p>If you have bought a website and need extra work done on it please click <a href="extrawork.htm">here</a>.</p>

          <p><font color="#10147E"><strong>Prices:</strong></font></p>

          <table cellspacing="0" cellpadding="0" border="0">
            <tbody>
              <tr>
                <td>A simple website with up to 5 pages</td>

                <td width="50"></td>

                <td><font color="#10147E"><strong>£70</strong></font></td>
              </tr>

              <tr>
                <td>A more advanced website with up to 10 pages</td>

                <td width="50"></td>

                <td><font color="#10147E"><strong>£100</strong></font></td>
              </tr>

              <tr>
                <td>A large website with up to 15 pages</td>

                <td width="50"></td>

                <td><font color="#10147E"><strong>£130</strong></font></td>
              </tr>

             

              <tr>
                <td>Every other page</td>

                <td width="50"></td>

                <td><font color="#10147E"><strong>£10</strong></font></td>
              </tr>

              <tr>
                <td><br></td>
              </tr>

              <tr>
                <td>Extra work (per hour)</td>

                <td width="50"></td>

                <td><font color="#10147E"><strong>£10</strong></font></td>
              </tr>
            </tbody>
          </table>

          <p>&nbsp;</p>

          <p>Just enter a valid email below to get started!<br></p>

          <form id="orderform" action="order.php" mehtod="post">
		   <input type="hidden" name="compare" value="1" />
            <b><font color="#10147E">Email:</font></b> <input id="email" name="EmailFrom"><br>
            <br>
			<p>Enter the characters you see in the image:</p>
			<input type="text" name="verify_input" maxlength="6" />
            <img src="verifyimg.php" alt="Verification" /><br><br>
            <input onclick="validate_form();" type="button" value="Submit" name="submit">
          </form>
        </td>

        <td width="24" height="467">&nbsp;</td>
      </tr>
    </tbody>
  </table>
</body>
</html>

Thanks for any help!

I have read your code and could I ask what version of php you have. Because this very same error keeps on being reported onto these php forums and nobody truly knows the answer. That is why I am now starting to study these T_variable errors on daniwebs to see what bug is behind php. The only pattern I have so far come across is as follows.

<?php

I suspect that the above code needs to be replaced with the below. I'm not sure why but one possibility is that php version 6 may not support the above type of php opening. So try replacing the php opening as shown in the above box with what is shown in the below box. And as I can see, you will have a few replacements to do.

<?
This article has been dead for over six months. Start a new discussion instead.