Jump to content

passing variables in a link


dannybrazil

Recommended Posts

Hello

I wanted to know if its possible to do something like that :

 

<a href="www.mysite.com?id=123&cat=456" method="post">click</a>

 

and in the next page to capture the variables as POST?

 

$id=$_post['id'];

 

basically what i want is to pass the variables in the link BUT capture them as POST methos

 

Danny

Link to comment
https://forums.phpfreaks.com/topic/173557-passing-variables-in-a-link/
Share on other sites

Hi,

 

If you really *have* to do this you could loop through all the $_GET values (ie the ones sent via the url) and add them the the $_POST array like this:

foreach($_GET AS $key=>$val){
  $_POST[$key]=$val;
}

Seems rather against the purpose of the $_POST variable though  :wtf:

Chris

passing the values the way you are currently is passing them by get values. What you can do is create hidden forms, and have that link submit the form that those hidden fields are part of, but you can't hide the get variables from the URL unless you use Mod rewrite or something like that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.