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)): ?>
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
Post a Comment