Page 1 of 1
Passing String
Posted: Tue Aug 09, 2005 7:47 am
by Ree
I need to pass a string (a message, to be specific) from one .php to another. $_GET obviously won't work well. One of the ways is using $_SESSION (but maybe it's a bit too much just for that, having in mind I won't need to pass/save any other data, just a string. Not sure on this, although using $_SESSION would be pretty easy and comfy). I thought maybe there's a way to $_POST the string to the page where I need it via PHP (that is, not manually pressing a button using HTML form)? If this way exists, which of the two (the latter or $_SESSION) eats up more resources?
Posted: Tue Aug 09, 2005 8:33 am
by feyd
$_SESSION is far easier to do than hidden posting.
Posted: Tue Aug 09, 2005 8:58 am
by Ree
Could you provide an example of how this 'hidden' posting is done? I assume, you recommend using $_SESSION in my case, right?
Posted: Tue Aug 09, 2005 9:08 am
by feyd
hidden posting involves using
cURL. Which is not the easiest to example, but I have posted curl examples in the past.
yes, I would suggest using sessions, especially if you want to end up on this second page. The hidden posting will do nothing on the current page. You won't jump anywhere, or do anything unless otherwise instructed..
Posted: Tue Aug 09, 2005 10:43 am
by Ambush Commander
Well, the thing is, if you used hidden posting, the page you posted the variable to would have no idea when the user comes around... so you'd end up building your own session handling structure. There's nothing inherently wrong with this (especially for distributed environments), but you should stick with $_SESSION
Posted: Tue Aug 09, 2005 10:49 am
by feyd
it wouldn't have data, unless the script doing the hidden posting displayed the results of said hidden post.

Posted: Tue Aug 09, 2005 10:54 am
by Ree
Thanks for you replies
