Jump to content

php if else statement and less than brilliant formatting


chen2424

Recommended Posts

Hi Guys,

 

this code seems to work in my osc header.php but it causes a slight conflict with another register function. Ive streamlined problem to be in this peice code, probably the if else part, can someone help out here pls, my php is far fm brilliant :-[, but im trying man.... thanks in advance! 8)

 

<table>

<?php if (tep_session_is_registered('customer_id')) {?>



<a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo  tep_image(DIR_WS_IMAGES . 'buttonlogout.jpg', HEADER_TITLE_LOGOFF); ?></a>

<a href="account_history.php"><img border="0" src="images/orderhistory.png"></a>

<tr><td><?php  }else{
echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));?></td></tr> 
<tr><td>Email       :<?php echo tep_draw_input_field('email_address');?></td></tr> 
<tr><td>Password:<?php echo tep_draw_password_field('password');?></td></tr> 
<tr><td><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN);
  } ?></td></tr> 

</table> 

 

kind regards, Chen

... not that i can see?

 

only problems i can see are HTML errors with your <tr> and <td> tags?

if the 'else' block executed, the first table row wouldn't have an opening <tr><td>, just a closing <tr><td>

 

try

<table>

<?php if (tep_session_is_registered('customer_id')) {?>



<a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo  tep_image(DIR_WS_IMAGES . 'buttonlogout.jpg', HEADER_TITLE_LOGOFF); ?></a>

<a href="account_history.php"><img border="0" src="images/orderhistory.png"></a>

<?php  }else{ ?>
<tr><td><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));?></td></tr>
<tr><td>Email       :<?php echo tep_draw_input_field('email_address');?></td></tr>
<tr><td>Password:<?php echo tep_draw_password_field('password');?></td></tr>
<tr><td><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>
</td></tr>
<?php } ?>

</table> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.