Programmers Help

Neeoo

Junior Member
Joined
Oct 6, 2010
Messages
156
Reaction score
112
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">
 
Hi!
Find on google a php function named header()
You can redirect to your affilite website...

Best
 
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">
 
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">

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?
 
I don't want google to see the affiliate link. So I want the affiliate link to be called into the form.
 
I don't want google to see the affiliate link. So I want the affiliate link to be called into the form.

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
 
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:
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.

I can try this, what would this script look like.
 
I can try this, what would this script look like.

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; ?>.
 
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; ?>.

The form is a button click, people need to fill in information and then click send. Thanks I will try this
 
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; ?>.

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;?>
 
Back
Top