Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.