php - unexpected endif line 34 don't know why -


parse error unexpected endif @ line don't know why

   <form name="contactform" method="post" action="check.php" class="form-horizontal" role="form">                         <?php   if(array_key_exists('errors', $_session));   ?>                      <div class="alert alert-danger">                         <?php implode('<br>', $_session['errors']); ?>                      </div>                     <?php unset($_session['errors']); ?>                 <?php endif;?> 

change

<?php   if(array_key_exists('errors', $_session));   ?> 

to:

<?php   if(array_key_exists('errors', $_session)):   ?> 

reference

explanation:

in code, putting semi-colon ; after if statement.

it means closing if control structure, hence, endif below has no meaning.

if put :, code between if , endif considered body of control structure , hence not produce error.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -