Hello friends,

How to Pass Variables from One Page to Another in PHP.

Thanks

Use $_SESSION (creating session), $_COOKIE (setting Cookie), $_POST (using post) or $_GET (send variable via URL)

i would use $_POST or $_GET

Member Avatar for diafol

I'd use sessions as a rule. You don't always want to pass data via a form or sometimes the querystring would be too long to hold all your variables (limit 256 chars). Depends on the data you want to pass - querystrings/get are fine for trivial things. BTW - DO NOT use $_REQUEST

You can always write to and read froma DB too. BUT, you'd probably need an identifier of some description too, like a session id hash in the url.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.