Populating Affiliate ID in Text Are URLs

6 replies
  • WEB DESIGN
  • |
Hi

I'm trying to set up my page where a click of a submit button will populate a variable in each text area code where it says affiliateID with the appropriate ID entered at the submit form. Not had any luck finding a good combination of code that does the job.

Code:
<p><img src="images/affiliatebanners/120x240.jpg" width="120" height="240"></p>
                           <p><textarea name="textarea8" cols="72" rows="3" id="final-text"><a href=<a href="mysite.com/affid=affiliateID" target="_blank"><img src="http://mysite.com/images/affiliatebanners/120x240.jpg" width="120" height="240" border="0"></a></textarea></p>                          
                          <p>&nbsp;</p>
Can anyone suggest dome code to do this?

Thanks

Andrew
#affiliate #populating #text #urls
  • Profile picture of the author Brandon Tanner
    See this post...

    http://www.warriorforum.com/main-int...ml#post8051874

    ^ The example in that post is for ClickBank affiliate ID's, but it can be easily edited to work with any type of affiliate ID. Let me know if you need any help with it.
    Signature

    {{ DiscussionBoard.errors[8452643].message }}
    • Profile picture of the author Andrew Servis
      Originally Posted by Brandon Tanner View Post

      See this post...

      http://www.warriorforum.com/main-int...ml#post8051874

      ^ The example in that post is for ClickBank affiliate ID's, but it can be easily edited to work with any type of affiliate ID. Let me know if you need any help with it.
      For using the jquery I don't understand what I am supposed to put in my text are where the HTML code is to populate each textarea XXXXX:

      Code:
      <p><textarea name="textarea9" cols="72" rows="3" id="textarea8"><a href="http://mysite.com/affid=xxxxx" target="_blank"><img src="http://mysite.com/images/affiliatebanners/120x600.jpg" width="120" height="600" border="0"></a></textarea></p>
                                <p>&nbsp;</p>
      I am not using DIVs for each link - is that a problem?

      I have downloaded jquery to my root directory and also wondering how to set that up in my html page so that I can use it?

      Thanks again

      Andrew
      {{ DiscussionBoard.errors[8462225].message }}
      • Profile picture of the author Brandon Tanner
        I went ahead and made a quick demo page for you. When the 'createLinks' button is clicked, it grabs the value from the 'affID' text box, then replaces all instances of xxxxx inside the textareas with that value.

        HTML Code:
        <!DOCTYPE html>
        <html lang="en">
        <head>
        </head>
        <body>
        
        <input id="affID" type="text">
        <button id="createLinks">Create Affiliate Links!</button>
        <br /><br />
        <textarea>Blah blah blah xxxxx blah blah</textarea>
        <textarea>Blah blah blah xxxxx blah blah</textarea>
        
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
        
        <script>
        $(document).ready(function() {
            var defaultID = "xxxxx";
            $('#createLinks').click(function(){
                var affID = $('#affID').val();
                $('textarea').each(function () {
                    var replacedText = $(this).text().replace(defaultID, affID);
                    $(this).text(replacedText);
                });
                defaultID = affID;
            });
        });
        </script>
        
        </body>
        </html>
        Signature

        {{ DiscussionBoard.errors[8464949].message }}
        • Profile picture of the author Andrew Servis
          Originally Posted by Brandon Tanner View Post

          I went ahead and made a quick demo page for you. When the 'createLinks' button is clicked, it grabs the value from the 'affID' text box, then replaces all instances of xxxxx inside the textareas with that value.

          HTML Code:
          <!DOCTYPE html>
          <html lang="en">
          <head>
          </head>
          <body>
          
          <input id="affID" type="text">
          <button id="createLinks">Create Affiliate Links!</button>
          <br /><br />
          <textarea>Blah blah blah xxxxx blah blah</textarea>
          <textarea>Blah blah blah xxxxx blah blah</textarea>
          
          <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
          
          <script>
          $(document).ready(function() {
              var defaultID = "xxxxx";
              $('#createLinks').click(function(){
                  var affID = $('#affID').val();
                  $('textarea').each(function () {
                      var replacedText = $(this).text().replace(defaultID, affID);
                      $(this).text(replacedText);
                  });
                  defaultID = affID;
              });
          });
          </script>
          
          </body>
          </html>
          Good stuff, I need to see these things in the flesh to see what they are actually doing. I did get one partially working a week ago but it was a bit messy and couldn't work out how to put expand it to all text areas due to the fact I was using bits from here and there.

          Thanks

          Andrew
          {{ DiscussionBoard.errors[8465295].message }}
  • Profile picture of the author LarryKeenan
    Hello Andrew
    This can be achiever using javascript.

    Visit Flash AR Forms
    View the page source and save to your local machine.

    Note the javascript at the top and the form and textareas
    at the bottom. To convert your original messages to javascript

    Visit Free HTML 2 JAVASCRIPT |html2javascript

    If you don't understand javascript, you now have the code examples
    to outsource it.

    Have a Great Day!
    Larry Keenan
    {{ DiscussionBoard.errors[8452846].message }}
    • Profile picture of the author Andrew Servis
      Cheeers guys will get a look at that tonight.

      Andrew
      {{ DiscussionBoard.errors[8454398].message }}

Trending Topics