PDA

View Full Version : if else statement



pauly
03-05-2010, 01:36 PM
I have a site with two buttons displayed, 'buy now' and 'add to cart'

I can't seem to get the codes to work in an if else statement. Can any one help?

add to cart button:
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>

buy now button:
<a class="button" href="<?php echo $buyurl; ?>" <span><?php echo $button_buy_now; ?></span></a>

if i put them in an if else statement I get unexpected "<" error

This is driving me nuts!

tomws
03-05-2010, 03:12 PM
See that sticky post at the top of this forum that is titled, "This forum is JUST for posting a PHP snippet. Questions go in the parent forum"? It's probably worth a glance. Once you see that, you can PM a mod to request this be moved.

Fou-Lu
03-05-2010, 04:41 PM
See that sticky post at the top of this forum that is titled, "This forum is JUST for posting a PHP snippet. Questions go in the parent forum"? It's probably worth a glance. Once you see that, you can PM a mod to request this be moved.

Taken care of.

Is the error a PHP or Javascript one? You don't have any code indicating an if/else construct, only the generation for links. Can you post the code where PHP is concerned?

masterofollies
03-05-2010, 07:48 PM
Post your whole code, or every line pertaining to the error. Many times it's the line above or below causing the error.