Ok, I am desperate to find this answer if any coder can help me I would be grateful. So here is my situation: I figured out how to pass variables from one page to another and to a url. So my next question is: Is there a way to pass variables out of my url or from a section of the web page and place it into the subid section of an affiliate link. So there is no confusion at all this is my goal. 1) Have a person fill out form on h**p://www.surveybeggar.com/test.html (It's a bit crude looking right now) a)So I fill out my Name: Eric & My Email: test@test<dot>com 2) when that person fills out the form they are redirected to a new page with the URL: h**p://www.surveybeggar.com/test2.html?FirstName=Eric&Email=test@test.com a) as you can see the first name & email are added to the domain but also on that page I have passed those two variables as text. Now here is what I want to have done.... There are two affiliate banner ads on this page. I have an affiliate banner with the following code: <a href="http://partners.pantheranetwork.com/z/3945/CD5923/&subid1=email"><img src="http://partners.pantheranetwork.com/42/5923/3945/&subid1=email" alt="" border="0"></a> What I want to do is trade that word email that is in red with the email address from the url (in this case - test@test<dot>com) or that is already on the page that I have passed from a previous page. How can I add the email address where I have put the word email in this code? I essentially want to add the email variable that is in the url &/or on the page above and have it automatically populate itself as a sub id in the banner ads. Can someone please help me learn how to do this or give me the snippet in java script to add to the end of my affiliate banner code that will populate the email variable? If you want to see what I have done, please view source of the following website: h**p://www.surveybeggar.com/test2.html?FirstName=Eric&Email=test@test.com thanks for any help. Will offer $10 via paypal, alert pay, or revolutionmoney exchange to anyone who can help!
hmmm... your first url looks like this: http://partners.pantheranetwork.com/42/5923/3945/&subid1=<?php echo $_GET['Email']; ?> Code (markup): which means for some reason it isn't parsing the php. Fix that problem it should work. also do the same thing for the second banner. its better to use php to pull get values, if you use javascript (like you are in some cases) you need to use the decodeURIComponent.
sorry, i took the php code out but didnt publish it....that code is out cause the php doesnt work. It shouldnt be there now. how do I use the decodeURIComponent? can you teach me that, please?
Its a (much) better solution to use PHP, you sure you can't use it? Here is a javascript function I wrote to emulate php's $_GET variable: (function(){ var parts = location.href.indexOf('?') >= 0 ? location.href.split('?')[1].split('&') : []; window.GET = []; for (var i = 0, l = parts.length, t; i < l; i++){ t = decodeURIComponent(parts[i]).split('='); GET[t[0]] = t[1]; } })(); PHP: so to get the Email variable: GET['Email'] PHP:
Got, this must be like working with an absolute amateur monkey for you...but I really appreciate it. ok, so its supposed to look like this?: (function(){ var parts = location.href.indexOf('?') >= 0 ? location.href.split('?')[1].split('&') : [Email]; window.GET = [Email]; for (var i = 0, l = parts.length, t; i < l; i++){ t = decodeURIComponent(parts).split('='); GET[t[0]] = t[1]; }})(); <a href="http://partners.pantheranetwork.com/z/3945/CD5923/&subid1=GET['Email']"><img src="http://partners.pantheranetwork.com/42/5923/3945/&subid1=GET['Email']" alt="" border="0"></a> I think I am still messing this up.
no, you don't change the function. add this to your <head> <script type="text/javascript"> (function(){ var parts = location.href.indexOf('?') >= 0 ? location.href.split('?')[1].split('&') : []; window.GET = []; for (var i = 0, l = parts.length, t; i < l; i++){ t = decodeURIComponent(parts[i]).split('='); GET[t[0]] = t[1]; } })(); onload = function(){ function $(el){ return document.getElementById(el); } var b1 = $('banner-1'), b2 = $('banner-2'), img1 = b1.getElementsByTagName('img')[0], img2 = b2.getElementsByTagName('img')[0]; b1.href = b1.href + GET['Email']; img1.src = img1.src + GET['Email']; b2.href = b2.href + GET['Email']; img2.src = img2.src + GET['Email']; }; </script> HTML: and add an id to both anchors, first anchor id="banner-1", second anchor id="banner-2". I'm telling you this for your benefit, it would be much better to do something like this server-side (php). That way even those who dont have js (search engines included) or don't have it enabled would see the correct link.
MMJ, Dont worry, I am upping your fee if this works. Ok, I added the code between the heads, as seen at: h**p://www.surveybeggar.com/test2.html?FirstName=Eric&Email=test@test.com but I am really a newbie, so please pretend like your speaking to a non coder or a monkey at the zoo. what do you mean "and add an id to both anchors, first anchor id="banner-1", second anchor id="banner-2"." also, what do i add in the banner code <a target="_blank" href="http://partners.pantheranetwork.com/z/3945/CD5923/&subid1=> after the &subid= to get it to pull the email address? I am really sorry. Usually I can do the basic stuff but this has totally dumbfounded me and perhaps, I am thinking too hard about this but now I cant understand anything
just add the id attribute to each link (anchor): <a target="_blank" href="http://partners.pantheranetwork.com/z/3945/CD5923/?subid1=" id="banner-1"><img src="http://partners.pantheranetwork.com/42/5923/3945/?subid1=" alt="" border="0"></a> HTML: <a target="_blank" href="http://partners.pantheranetwork.com/z/7442/CD5923/?subid1=" id="banner-2"><img src="http://partners.pantheranetwork.com/42/5923/7442/?subid1=" alt="" border="0"></a> HTML: and leave the subid1 empty, the javascript function just appends the email right to it.
ok MMJ Thanks....As soon as I read what you typed I felt like a moron...thanks for your patience Now I did exactly what you typed an added the id to the first anchor link in banner one. However, after publishing the page, I placed my mouse over the banner it only shows: h**p://partners.pantheranetwork.com/z/3945/CD5923/?subid1= The email address didnt append to it in the rollover. Any ideas. If you need to, you can check my source code at to see what I did wrong at: h**p://www.surveybeggar.com/test2.html?FirstName=tester&Email=chicken@chicken.com
For some reason when you copied the javascript code all the newlines disappeared. Try copying it again: <script type="text/javascript"> (function(){ var parts = location.href.indexOf('?') >= 0 ? location.href.split('?')[1].split('&') : []; window.GET = []; for (var i = 0, l = parts.length, t; i < l; i++){ t = decodeURIComponent(parts[i]).split('='); GET[t[0]] = t[1]; } })(); onload = function(){ function id(el){ return document.getElementById(el); } var b1 = id('banner-1'), b2 = id('banner-2'), img1 = b1.getElementsByTagName('img')[0], img2 = b2.getElementsByTagName('img')[0]; b1.href = b1.href + GET['Email']; img1.src = img1.src + GET['Email']; b2.href = b2.href + GET['Email']; img2.src = img2.src + GET['Email']; }; </script> Code (markup): <a target="_blank" href="http://partners.pantheranetwork.com/z/3945/CD5923/?subid1=" id="banner-1"><img src="http://partners.pantheranetwork.com/42/5923/3945/?subid1=" alt="" border="0"></a> <a target="_blank" href="http://partners.pantheranetwork.com/z/7442/CD5923/?subid1=" id="banner-2"><img src="http://partners.pantheranetwork.com/42/5923/7442/?subid1=" alt="" border="0"></a> HTML:
ok I copied it again exactly as I see it posted here and still nada. What am I missing? I am getting the info to pass from: h**p://www.surveybeggar.com/test.html & after i type in Eric for Name and test@test<dot>com for email, they arrive at fine at: h**p://www.surveybeggar.com/test2.html?FirstName=Eric&Email=test@test.com I put in the exact code you have above in btw the heads and inserted the sub id you gave me but nada....i copied the short cut and you can see the ?subid= and there is nothing following. h**p://partners.pantheranetwork.com/z/3945/CD5923/?subid1=
Ah, there is a small hidden problem. In the body tag you have onload="" which stops my script from running. Remove that and it should work.
Hey MMJ, Ok so I hit a snafu....I developed the website through a no brainer program from homestead, and when I discussed taking out that tag, they said that it isnt possible or they wont. So I am stuck. I recently saw someone who has developed what I want to do as well. their site is www<dot>CashBackResearch<dot>com. When you fill out the info on their site and click Get Started, it goes to a similar page but your email address are auto filled in the banner as seen when I rolled over it with my mouse. I noticed they used java script as well. How did they do it? I perused their source code but cant honestly understand it. Any ideas on how to get me there?
haha...hey, hcbeggar...you are getting people to do a lot of running around for you for an offer of $10. why don't you spend that $10 bucks instead on getting a good webhost?
haha...thanks Ninja....throw a Ninja star at a guy when he is down why dont you. Actually, MMJ has been very helpful thus far, & I planned on upping the ante for him helping if we can get this figured out. I am probably going to have to build a seperate "subsite" for this function anyways. So perhaps your right. Thanks for checking up on me and my mess. ~E
I'm not doing it solely for the $10 or whatever, if I get cash then thats just a plus. All it takes is to remove that attribute but anyways try this: <script type="text/javascript"> (function(){ var parts = location.href.indexOf('?') >= 0 ? location.href.split('?')[1].split('&') : []; window.GET = []; for (var i = 0, l = parts.length, t; i < l; i++){ t = decodeURIComponent(parts[i]).split('='); GET[t[0]] = t[1]; } })(); var ie = window.attachEvent; window[ie ? "attachEvent" : "addEventListener"]((ie ? "on" : '') + "load", function(){ function $(el){ return document.getElementById(el); } var b1 = $('banner-1'), b2 = $('banner-2'), img1 = b1.getElementsByTagName('img')[0], img2 = b2.getElementsByTagName('img')[0]; b1.href = b1.href + GET['Email']; img1.src = img1.src + GET['Email']; b2.href = b2.href + GET['Email']; img2.src = img2.src + GET['Email']; }, false); </script> Code (markup): I tried it and it worked.
to be honest, i just don't buy this - why the xxxx can't a body onload= be removed? if its constraints of WYSIWYG 'design' software, then by god--view source and edit it yourself, don't call some xxxxwits on some helpdesk to be told that you can't... that aside, kudos to MMJ for finding a way
SUCCESS!!! Thank You MMJ for all your help, I will try to Private message you to obtain your paypal or such.