I created a form with the post method. I can call $_POST from the page with the form itself, but not from a different page on the same site. What might I be doing wrong?
For instance, the following code returns values on the form page, but not the other page.
<?php
echo '<pre>';
print_r($_POST);
echo '</pre>';
?>
Thanks for any thoughts.
Super-Globals not available from other pages
Moderator: General Moderators
Re: Super-Globals not available from other pages
$_POST would only be populated for a page requested with POST headers... what exactly are you hoping to find there?
Re: Super-Globals not available from other pages
you'll only be able to retrieve what's in $_POST in the page that you've sent it through in the <FORM> tag. So if its sent to PHP_SELF it'll be the same page or if you want to retrieve in another page you'll have to send it there.
hope this helps
hope this helps
Re: Super-Globals not available from other pages
Thanks pytrin and deejay for your responses.
The book "Codin' for the Web" says "super-global arrays are so called because the data they contain is available at any time from any page."
Both of your resposes suggest that this isn't exactly so. How then do I send these variables to a different page?
Thanks for your help with this.
The book "Codin' for the Web" says "super-global arrays are so called because the data they contain is available at any time from any page."
Both of your resposes suggest that this isn't exactly so. How then do I send these variables to a different page?
Thanks for your help with this.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Super-Globals not available from other pages
Not a very well written sentence, but technically true. (note to self: don't by books named Codin'rhecker wrote:The book "Codin' for the Web" says "super-global arrays are so called because the data they contain is available at any time from any page."
You can get the values from the $_POST array and add them to the appropriate link URLs on the page so the values are passed forward. Or you can save them in a cookie, the session, a file, a database, etc.rhecker wrote:Both of your resposes suggest that this isn't exactly so. How then do I send these variables to a different page?
(#10850)
Re: Super-Globals not available from other pages
Actually this is incorrect. Super global arrays are available everywhere, but the data they contain is different depending on the environment.The book "Codin' for the Web" says "super-global arrays are so called because the data they contain is available at any time from any page."