how to pass the <img src > as a variable in the method

Discussion in 'PHP' started by kumar84, Aug 24, 2007.

  1. #1
    hi friends

    i have some doubt on this

    PET <img src="pet.jpg"> <a href="#">add to profile</a>


    if i click this add to profile link it should pass the <img src="pet.jpg"> as a string in one variable($link) and then this $linkvariable should be pass to one method $facebook->api_client->profile_setFBML($link,$user)

    like that if i click the other link means
    PET1 <img src="pet1.jpg"> <a href="#">add to profile</a>

    it also should pass the <img src="pet1.jpg"> as a string in one variable and then this link should be pass to the same method $facebook->api_client->profile_setFBML($link,$user)

    like that it should go continuously goes on for every <img src="pet2.jpg">

    can anybody help me how to write php code for this
     
    kumar84, Aug 24, 2007 IP
  2. Eps

    Eps Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Right, first off, you need to add some code to the link itself. Lets asume the script to handle the data is script.php. Then:

    <?php
    $img = '<img src="pet.jpg">';
    ?>
    PET <?=$img; ?> <a href="script.php?img=<?=rawurlencode($img); ?>">add to profile</a>
    HTML:
    Then in script.php:

    $link = @$_GET['img'] or $link = '';
    
    if($link != ''):
    $link = rawurldecode($link);
    $facebook->api_client->profile_setFBML($link,$user);
    endif;
    PHP:
     
    Eps, Aug 25, 2007 IP