Phppost
Is there anyway to send information through post without using a form? I was hoping there was some trick to get $_POST to work just like a regular array that I can add information too like:
$_POST[] = $whatever;
Or any other way to send information from one page to another without making it visible for the user as in GET?
$_POST[] = $whatever;
Or any other way to send information from one page to another without making it visible for the user as in GET?
Comments
Originally posted by ast3r3x
Is there anyway to send information through post without using a form? I was hoping there was some trick to get $_POST to work just like a regular array that I can add information too like:
$_POST[] = $whatever;
Or any other way to send information from one page to another without making it visible for the user as in GET?
I'd like to know this as well. I haven't found anyway of passing information between pages without using get unless it's some sort of form. As far as I know, POST is a form function so I can't imagine it'd work without one.
Originally posted by DCmac32
I don't know if this is what you are looking for, but couldn't you put a hidden form and a hidden field at the bottom of the first page that can post to the next page.
The problem with this (I believe) is that the information won't be passed along unless the form is submitted. Since you don't always want to have to press a button to pass information, you run into problems.
I'll tell you though, I like programming in PHP, but I tend to do stuff all in one page, so I normally use at least one global variable, and my C++ teacher always tried to have us to stay away from them (not sure why) so I have this stigma that they are bad to use. I don't mind using globals like $_SESSION, $_GET, or $_POST though, because they are so nicely contained and seem appropriate;
(I'm slightly obsessive compulsive)
i used to code PHP in one page but it got too hard to maintain for me as i kept adding things. it got hard too read and i hated scrolling on long pages when coding.
For more complex data you should use sessions. The built in PHP kind or some session mechanism of your own. (In my case, DB-based session handling is a standard part of my web framework.)