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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post

    How do I put together this if else?

    Currently a page will show a (send message) link using
    PHP Code:
    <?php echo '&nbsp;<a href="compose.php?recipient='?>
    But I would like to add and if else statement to it where if a non-paid member tries to send the person a message it will take them to mydomain.com/index.php?page=freemail. I've tried adding the following script before the above code but I can't get it to work. I'm sure I'm just not structuring it correctly.

    PHP Code:
    <?php echo '&nbsp; {if $smarty.session.security.viewemail == '0' }
    <a href="http://mydomain.com/index.php?page=freemail" >
    {else}
    <a href="compose.php?recipient='
    ?>
    Do I need to add a {/if} at the end also?
    Last edited by sfraise; 03-12-2009 at 10:54 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Don't echo the "if" statement; instead use echos inside the "if" statement's blocks:

    PHP Code:
    if ($smarty.session.security.viewemail == '0') {
        echo 
    '<a href="http://mydomain.com/index.php?page=freemail" >';
    } else {
        echo 
    '<a href="compose.php?recipient=';



  •  

    Posting Permissions

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