Javascript GetElementbyID function

6 replies
Hey All Programmers,

I'm putting together an affiliate page where I am asking the affiliate to sign up to my affiliate program which signs them up with aweber (this works) at the same time I am also asking them for their Clickbank ID.

I then want this ID to be pre-populated throughout the page on all the affiliate tools where I enter xxxxxx as default

Can someone please advise how I would do this.

Appreciate any help you can give me.

Thanks in advance

Darren
#function #javascript #replace #string
  • Profile picture of the author Juturna
    Are you solely wanting to do this with Javascript? Sounds like it would be a TON easier with just a few php variables, and then dynamically place them in the xxxxxx areas.
    {{ DiscussionBoard.errors[2262113].message }}
  • Profile picture of the author mywebwork
    I'm in agreement with Juturna, unless this is an AJAX design I see no reason to use JavaScript here. Pass the variable to the page within the URL and use PHP's $_GET function to extract it and populate the tools.

    Bill
    {{ DiscussionBoard.errors[2262245].message }}
  • Profile picture of the author Oakleaf
    Here's a rough outline of how you could do it in php.

    In the signup form, add another field for the clickbank id of your user(with name like clickbankid or something). I suppose that you have the affiliate link of the clickbank product(s) already(lets say it's $oldurl), just do a simple php string replace like so

    <? $finalurls = str_replace("xxxxx", $_POST['clickbankid'], $oldurl); ?>

    And then use this variable to construct the final affiliate link. If you have more than one product, create an array of all those old affiliate links and then loop through it replacing the strings before constructing the page.
    {{ DiscussionBoard.errors[2263611].message }}
    • Profile picture of the author graphicsgenie
      Thanks for your help.

      I'm not able to do any coding myself, willing to take a look if I send you the file? $30 budget ?


      Any takers?

      Darren
      {{ DiscussionBoard.errors[2263625].message }}
      • Profile picture of the author Oakleaf
        Originally Posted by graphicsgenie View Post

        Thanks for your help.

        I'm not able to do any coding myself, willing to take a look if I send you the file? $30 budget ?

        Any takers?

        Darren
        I'll take a look and see if I can fix it, send the files over to articlehello [at] hotmail [dot] com, btw I can't send PMs.
        {{ DiscussionBoard.errors[2263775].message }}

Trending Topics