![]() |
Appending links with PHP
Fuck the paid applications out there that do this, I want to do this in-house, you know, for free:
I am looking for a resource/documentation on using form action on my affiliate site that allows affiliates to enter their affiliate ID, and have a PHP function that can append the affiliate links with the user's ID as a cookie. I've googled it, yes, but I might as well google "help"--I get that many irrelevant results. I'm just on the cusp of figuring out with PHP, I just need a push in the right direction. |
ok you want something like:
Put this at the top of your page: Code:
<?php session_start(); #<-- Must be first line Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Code:
<?php echo $affid; ?> Rob |
Thanks Robber!
Working this into my site. I forgot to mention it's a wordpress site, so perhaps a little more tricky working with the loop. My content is searchable, which puts the search results on a different page than the index. Can I place the code in my header, which appears on every page regardless if it's index, search, archive, etc...? Also, does this store the id to cookies? I would like to have the user's ID cookied, so it appends the link every time the user visits, without them having to enter the id every time. |
OK then to have this set in a cookie like you have requested you would need to change the header script to being:
Code:
<?php Hope this helps. Please feel free to ask if you have any other questions Rob |
Then I would change the form action slightly as well, no?
changing from PHP Code:
PHP Code:
|
No you leave everything else the same as the rest is what runs the form. if you need help integrating this please drop me an e-mail: [email protected] (replace the 0's with o's) and I will go through it with you and answer any other questions you have
Kind Regards Rob |
hey robber great job man . even I also learnt from this . thanks from my side too.
|
Hi Guys,
I've just looked back over what I wrote and I need to amend the header scripts just slightly. But I have also expanded on a few points raised above as well regarding processing and how to do this in a separate file ################################################## If you are storing your affiliate ID in a session, your header script should be: Code:
<?php session_start(); #<-- Must be first line Code:
<?php Code:
<form action="<?php ### If Using Sessions ### Code:
<?php Code:
<?php Then wherever you would like to insert the affiliate code put: Code:
<?php echo $affid; ?> If you are storing your affiliate ID in a database, please contact me and I will help you write the code as every database is different in design and naming and so I wouldn't be able to cover that in this tutorial. Please send help requests to: [email protected] (please replace the 0's for o's) Rob |
All times are GMT -7. The time now is 02:37 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123