Parse error: syntax error, unexpected T_ENDIF in /home/comp3170-020/public_html/assignment1/index.php on line 44

StackOverflow https://stackoverflow.com/questions/21866462

  •  13-10-2022
  •  | 
  •  

Pergunta

     <?php
    if (!empty($_SESSION['err'])): ?>
    <tr>
      <td width="220" class="content_l" > <font color = "ff0000"> 
       <?php foreach ($_SESSION['err'] as $err): echo $err.'<br>';  ?> </td>
     </tr>
     <?php
     endif;
     unset($_SESSION['err'];
     ?>

Keep getting this error, cant see anything wrong.

Foi útil?

Solução

It should be this way:

   <?php
if (!empty($_SESSION['err'])):
?>
<tr>
  <td width="220" class="content_l" > <font color = "ff0000"> 

   <?php foreach ($_SESSION['err'] as $err){ echo $err.'<br>'; }?> </td>

 </tr>

 <?php
 endif;
 unset($_SESSION['err']);
 ?>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top