Unstoppable Domains

[Php] Passing variables to different sites

Spaceship Spaceship
Watch

Alex.

Account Closed
Impact
5
hi, i want to send a variable to a site i link to.

i cannot use a form, the script has to send the var without any user input.

ie, when i click an affilate link on my site, it redirects to a page on the site, which sends the var onto the next site.

using get is a last resort, because ideally i dont want the user to see the var.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
I think you are going to have to pass the variable with get unless you want to make some JS script that creates a form, the action, the inputs, and submits it..
 
0
•••
0
•••
0
•••
here's code for two ways...

without using GET, you can do with a simple form and JS event to submit...
Code:
<form id="mysecretform" method="POST" action="http://link.to/passvar.to">
<input type="hidden" name="mysecretvar" value="itsasecret" />
</form>
<a href="#" onclick="document.getElementById('mysecretform').submit();">Method 1</a>

And like Dan said, you can make it all in a JS function to do it all so it's all reusable and such...
within <head> section...
Code:
<script type="text/javascript">
function sendSecret(myVar, myVal, target) {
    hiddenVal = document.createElement("input");
    hiddenVal.type = "hidden";
    hiddenVal.name = myVar;
    hiddenVal.value = myVal;
    myForm = document.createElement("form");
    myForm.method = "POST";
    myForm.action = target;
    myForm.appendChild(hiddenVal);
    document.body.appendChild(myForm);
    myForm.submit();
}
</script>

and on the link...
Code:
<a href="#" onclick="sendSecret('mysecretvar', 'itsasecret', 'http://link.to/passvar.to');">Method 2</a>

I tested them on FireFox, it should work on all browsers though
 
Last edited:
0
•••
From what your saying... do you mean just using GET?
ie, when i click an affilate link on my site, it redirects to a page on the site, which sends the var onto the next site.

You could just use get and obfuscate the variables by encoding the values. Just set link to something like mypage.php?var1=lol&var2=whatever&etc=etc
 
0
•••
manofgames said:
using get is a last resort, because ideally i dont want the user to see the var.



Try plong0's code. :)
 
0
•••
thanks for your help.
i think the simplest way for me to do it is encode the var and sand it via get.

problem resolved
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back