Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    if else statement

    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!

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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.
    Are you a Help Vampire?

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by tomws View Post
    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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #4
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Post your whole code, or every line pertaining to the error. Many times it's the line above or below causing the error.
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •