Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A little help with an ELSE statement pls


Mighty Mike

Recommended Posts

Posted

<table border="0" cellspacing="10" cellpadding="0" align="center">

<td align="center" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' .

 

tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' .

 

tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';

} else {

'<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_create_account.gif',

 

IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>';

}

}

?>

 

 

Parse error: parse error, unexpected T_ELSE :angry:

 

 

For the life of me i cant get this to work, i have been trying for hours with no luck and was hoping someone could explain what i am doing wrong. :'(

 

I am doing this is product_info, i can get the add wishlist button to display fine but i get stuck when trying to do the "ELSE"

 

thanks

Posted
<table border="0" cellspacing="10" cellpadding="0" align="center">

                <td align="center" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' .

 

tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' .

 

tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';

  } else {

'<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_create_account.gif',

 

IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>';

    }

  }

?>

Parse error: parse error, unexpected T_ELSE  :angry:

For the life of me i cant get this to work, i have been trying for hours with no luck and was hoping someone could explain what i am doing wrong.  :'(

 

I am doing this is product_info, i can get the add wishlist button to display fine but i get stuck when trying to do the "ELSE"

 

thanks

 

 

think you forgot the opening {

Treasurer MFC

Posted

<td align="center" class="main">

<?php

if (tep_session_is_registered('customer_id'))

{

echo '<a href="' .

tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action= add_wishlist') . '">' .

tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';

}

else

{

'<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_create_account.gif',

IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>';

}

?>

 

the else statement comes totally behind the if in curly-braces..

Posted
<td align="center" class="main">

<?php

    if (tep_session_is_registered('customer_id'))

        {

            echo '<a href="' .

            tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=                        add_wishlist') . '">' .

            tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';

        }

        else 

        {

            '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' .        tep_image_button('button_create_account.gif',

            IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>';

        }

?>

 

the else statement comes totally behind the if in curly-braces..

 

 

yes but don't forget the echo in the else statement:

 

<td align="center" class="main">

<?php

if (tep_session_is_registered('customer_id'))

{

echo '<a href="' .

tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action= add_wishlist') . '">' .

tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>';

}

else

{

echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_create_account.gif',

IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>';

}

?>

Treasurer MFC

Archived

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

×
×
  • Create New...