display php code

Discussion in 'PHP' started by bobocheez, Dec 10, 2008.

  1. #1
    Hi, I have a site that has a referral link in it.
    The referral link is displayed normally and I also want to add a banner. However, I'm not too sure how to display the banner code with the link in it.

    user link:
    http://site.com/index.php?page=register&invcod=$arrusr[0]
    PHP:
    code needed to display(it should work like the link above and display the users referral link in it and not the $ arr usr part):
    <a href="http://site.com/index.php?page=register&invcod=$arrusr[0]"><img src="http://vivas.me/images/user_banner.gif" border="0"></a>
    PHP:
     
    bobocheez, Dec 10, 2008 IP
  2. xxKillswitch

    xxKillswitch Peon

    Messages:
    331
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know exactly what your asking, but have an idea. You just want to display the link and banner, correct? Not a banner depending upon the value of the link? Try...

    <a href="http://site.com/index.php?page=register&invcod=<?php echo $arrusr[0]; ?>"><img src.... /></a>
     
    xxKillswitch, Dec 10, 2008 IP
  3. bobocheez

    bobocheez Active Member

    Messages:
    403
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #3
    no

    the script displays a referal url, that url is different for every person, but the $ arr usr part is the one showed in the code of the script
    so it would be great if each person had their own url already inserted into the banner code, so they could just highlight it and paste it somewhere
    i tried various things like echo and code both php and html but no luck
     
    bobocheez, Dec 11, 2008 IP
  4. misbah

    misbah Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    68
    #4
    try this
    
    echo '<a href="http://site.com/index.php?page=register&invcod='.$arrusr[0].'"><img src="http://vivas.me/images/user_banner.gif" border="0"></a>';
    PHP:
     
    misbah, Dec 11, 2008 IP
  5. farad

    farad Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <form name="refcode">
    <input type="text" name="code" style="width:500">
    </form>
    HTML:
    <?php
    $refcode = "<a href=http://site.com/index.php?page=register&invcod=$arrusr[0]><img src=http://vivas.me/images/user_banner.gif></a>";
    ?>
    PHP:
    <script type="text/javascript">
    document.refcode.code.value = '<?php echo $refcode;?>';
    </script>
    Code (markup):
    Put it all together and woalaa .. :cool:
     
    farad, Dec 12, 2008 IP
  6. bobocheez

    bobocheez Active Member

    Messages:
    403
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #6
    thats magic
    that takes skill
    thanks farad
     
    bobocheez, Dec 12, 2008 IP
  7. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Just for the heck of valid html though, you should have double quotes, lol.

    <?php
    $refcode = '<a href="http://site.com/index.php?page=register&amp;invcod='.$arrusr[0].'"><img src="http://vivas.me/images/user_banner.gif" alt="banner" /></a>';
    ?>
    PHP:
     
    chopsticks, Dec 12, 2008 IP
  8. bobocheez

    bobocheez Active Member

    Messages:
    403
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #8
    it works either way
    but your right, for it to be compatible with most things that is the best way
     
    bobocheez, Dec 12, 2008 IP