1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Programmers Help

Discussion in 'White Hat SEO' started by Neeoo, Jul 9, 2011.

  1. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    I need to do the following. In my form I would like to use a php file that contains my affiliate link to be called into the form itself. As you can see the php file will take the place of the affiliate link. My question is how do I code the php file.

    <form style="padding-left: 270px;" action="hxxp://url . com/ affiliatefile.php" method="get">
     
  2. iamnotperfectbut

    iamnotperfectbut Newbie

    Joined:
    Jul 9, 2011
    Messages:
    7
    Likes Received:
    2
    Hi!
    Find on google a php function named header()
    You can redirect to your affilite website...

    Best
     
  3. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    I don't want to redirect I want to call the affiliate link in my php script into the main html section where the form is.

    For example.

    The affiliatefile . php would be replaced with my affiliate link.

    So This would
    <form style="padding-left: 270px;" action="hxxp://url . com/ affiliatefile.php" method="get">

    turn into this when the user click ok to run the form
    <form style="padding-left: 270px;" action="hxxp://my affiliate link" method="get">
     
  4. JohnsonDaniel

    JohnsonDaniel Regular Member

    Joined:
    May 16, 2008
    Messages:
    389
    Likes Received:
    1,385
    Location:
    In a bright place---------------------------------
    If you want the action for your form to be a submission to your affiliate link, why not just code it like you showed?

    <form style="padding-left: 270px;" action="hxxp://my affiliate link" method="get">

    What do you want the php file to do?
     
  5. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    I don't want google to see the affiliate link. So I want the affiliate link to be called into the form.
     
  6. JohnsonDaniel

    JohnsonDaniel Regular Member

    Joined:
    May 16, 2008
    Messages:
    389
    Likes Received:
    1,385
    Location:
    In a bright place---------------------------------
    Create a folder on your domain, set robots.txt to not index it, protect also with htaccess if you wish.
    Stick an index.php in there, with a Location redirect to your affiliate link.
    Then, on the main page, where you don't want your afflink to be seen by the SE's, just link to the folder you created, i.e.

    HTML:
    http://mydomain.com/myfolder
    Search for "cloak links" if you're wanting to handle multiple links at once, there are plenty of ways to link to things without incurring SEO penalties.

    HTH
     
  7. artizhay

    artizhay BANNED BANNED

    Joined:
    Nov 21, 2010
    Messages:
    1,867
    Likes Received:
    1,335
    It may be easier to just set the action via javascript. In fact, try using PHP to echo your affiliate link in the JS code, then use the JS code to set the action. This is used to hide dates from Google so it doesn't include them in the meta description (i.e. you want "My description." instead of "Jan 12, 2006 - My description.") so I don't see why the same technique wouldn't work for this.
     
    Last edited: Jul 10, 2011
  8. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    I can try this, what would this script look like.
     
  9. artizhay

    artizhay BANNED BANNED

    Joined:
    Nov 21, 2010
    Messages:
    1,867
    Likes Received:
    1,335
    HTML:
    <html>
    <head>
         <script type="text/javascript">
         function changeAction() {
              document.form_name.action = "<?=$affiliateUrl;?>";
         }
         </script>
    </head>
    <body onload="changeAction()">
    <form name="form_name" action="">
    </form>
    </body>
    </html>
    
    Also, you could use any type of action call, not just onload. Such as a button click, form click, etc. to further hide from Google.

    The <?=$affiliateUrl;?> is valid PHP. Most people are not familiar with that syntax. If you would prefer, you can use <? echo $affiliateUrl; ?>.
     
    • Thanks Thanks x 1
  10. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    The form is a button click, people need to fill in information and then click send. Thanks I will try this
     
  11. JohnsonDaniel

    JohnsonDaniel Regular Member

    Joined:
    May 16, 2008
    Messages:
    389
    Likes Received:
    1,385
    Location:
    In a bright place---------------------------------
    Nice code Artizhay :)
    Just a quick pointer for anyone who finds it doesn't work...
    Although the code IS valid php, some servers won't accept PHP short tags.
    If you have issues, replace the start tags by adding "php" to them.

    PHP:
    <?=$affiliateUrl;?>
    or

    PHP:
    <? echo $affiliateUrl;?>
    for

    PHP:
    <?php=$affiliateUrl;?>
    or

    PHP:
    <?php echo $affiliateUrl;?>