Passing String
Moderator: General Moderators
Passing String
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?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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..
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..
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
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