Unexpected T_ENDIF error, can't see why

Think I might just be going crazy. I’m getting a parse error on a script which works fine on the remote server, but not locally. I’ve even downloaded the scripts from the remote server, but I’m getting the same error: unexpected endif. Here’s my script:

<div id="content_1">
  <div class="outer">
  <div class="inner">
  <p><a href="?add">Add New User</a></p>
      <? foreach ($users as $user) :
	    [B]if (isset($user['id'])) :[/B]?>
      <form action="" method="post">
        <td><?php htmlout($user['name']); ?></td> <!-- custom function see 'helpers.inc.php' -->
        <td><?php htmlout($user['username']); ?></td>
        <td><?php if($user['authorityid'] > 1){ echo 'Co-ordinator'; } else { echo 'Administrator'; } ?></td>
          <input type="hidden" name="id" value="<?php echo $user['id']; ?>" /><input type="submit" name="action" value="Edit" />
          <input type="submit" name="action" value="Delete" />
      <?php [B]endif;[/B]
	  endforeach; ?>

Can anyone see something I can’t?


It may be misinterpreting :?> as a single token? Try putting a space at the end of that if statement.

It looks like you have the short_open_tag php.ini option turned off (that is good!), so PHP will not consider <? as the start of a PHP code block.

Simply change <? at line 10 of the code above into &lt;?php

Thanks to both of you for your reply. Yes the short tag is what did it. I probably deleted the ‘php’ part of the tag somewhere along the line.

Took so long to see it! D’oh!

Thanks again though,