Hello EveryOne

I confuse of bellow code

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php}else{?>
    <a href="/#"> Aleary applied </a> 
<?php }?>

Given Me Error Parse error: syntax error, unexpected '}'
BUT Solved It: When i replace '<?php' else to '<?' it could be solved.

But why it was Happen i could not understand.
Any One suggest me ?

Thank You.

Recommended Answers

I recommend to insert spaces:

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php } else { ?>
    <a href="/#"> Aleary applied </a> 
<?php } ?>
Jump to Post

All 4 Replies

Re: <?php start tag given me error in Codeigniter 80 80

line 3 should be <?php else { ?>

Re: <?php start tag given me error in Codeigniter 80 80

I recommend to insert spaces:

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php } else { ?>
    <a href="/#"> Aleary applied </a> 
<?php } ?>
commented: @AndrisP : Thank You. +1
Re: <?php start tag given me error in Codeigniter 80 80

Sorry I was wrong.

Re: <?php start tag given me error in Codeigniter 80 80

good catched AndrisP. Spaces indeed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.