Jump to content

script to script value/variable transfer.


lewashby
Go to solution Solved by AbraCadaver,

Recommended Posts

I've scooped up the variables via $_POST from and html from and now they're available in my current php script/file. But what if I wanted to send those values to another php script that will not have the luxury using $_POST to gather the html form variables since the form points to the script that executed/called the current script, not the current script it's self. Any ideas on how I can accomplish this? Thanks.

Link to comment
Share on other sites

I have a script that gets it's values via $_POST and then jumps to another script via the header() function, so I need to somehow pass the variables from the first script to the one that the header function jumps to. I think I need to take a look into sessions.

Link to comment
Share on other sites

  • Solution

Sessions or if they are simple vars that don't need to be hidden you can put them as get params in the redirect URL:

header("Location: www.example.com/page.php?var=$var1&var2=$var2');

Then get them on the next page:

echo $_GET['var1'];

But I would probably use sessions, and it will be handy to learn them.

Link to comment
Share on other sites

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.