Parse error: syntax error, unexpected $end

Permalink 1 user found helpful
I want to show check box with check mark and text box depends upon $carry value.
If the $carry=0. I want to disable check box tick and text box should not be appear.
If the $carry!=0, I want to put a tick mark on check box and want to show the text box.
This is my code,
<?php if($carry==0) { ?>
<tr><td><input type="checkbox"  class="ccm-input-checkbox" name="carry_frwd" id="carry_frwd" onclick="cry_frwd()"/><?php echo t('Enable Carry Forward');?></td></tr>
<tr id="carry_forward" style="visibility:collapse"><td><?php print $form->label('carry','Carry Forward');?></td>
<td><?php print $form->text('carry',$carry);?></td></tr>
<?php}
 else
{ ?>
<tr><td><input type="checkbox"  class="ccm-input-checkbox" name="carry_frwd" id="carry_frwd" checked onclick="cry_frwd()"/><?php echo t('Enable Carry Forward');?></td></tr>
<tr id="carry_forward" style="visibility:visible"><td><?php print $form->label('carry','Carry Forward');?></td>
<td><?php print $form->text('carry',$carry);?></td></tr>
<?php}?>

But it says,
Parse error: syntax error, unexpected $end in /home/ramki/public_html/concrete_erp/single_pages/category_edit.php on line 55

Line 55 is end of my code line
I know if statement only struggle with me on this problem.
But I don't know how to fix this...
Plz give me some suggestions...

cjramki
View Replies:
chemmett replied on at Permalink Reply
chemmett
I don't think the error is in the section of code you pasted. This error means somewhere in the file, there's a quote, a curly bracket, or a parenthesis that isn't closed. I don't see any of those in this code, so I'm guessing the error is higher up in the file.
cjramki replied on at Permalink Reply
cjramki
Thanks for the reply @chemmett,

Now I'm using if else syntax like the below. Now it works.
<?php if ( $carry==0 ) : ?>
            <tr><td><input type="checkbox"  class="ccm-input-checkbox" name="carry_frwd" id="carry_frwd"  value="1" onclick="cry_frwd()">
              <?php echo t('Enable Carry Forward');?></td></tr>
              <tr id="carry_forward" style="visibility:collapse"><td><?php print $form->label('carry','Carry Forward');?></td> 
               <td><?php print $form->text('carry',$carry);?></td></tr> 
            <div class="message">some message here!</div>
            <?php else : ?>
            <tr><td><input type="checkbox"  class="ccm-input-checkbox" name="carry_frwd" id="carry_frwd"  value="1"checked onclick="cry_frwd()">
              <?php echo t('Enable Carry Forward');?></td></tr>
              <tr id="carry_forward" style="visibility:visible"><td><?php print $form->label('carry','Carry Forward');?></td> 
               <td><?php print $form->text('carry',$carry);?></td></tr> 
            <div class="error">some error here!</div>
            <?php endif ?>
nerdess replied on at Permalink Reply
nerdess
i got an error similar like yours after i upgraded my mac to another php version. the new version did not like php code being added to the template with <? so i had to change those occurences (luckily it were not many) to <?php.