Passing variables to an https page

The situation I have is I am using a php controller page and it opens a main page that is unsecured. Once the user makes a selection, the controller sets the value of several variables and does an include to open the new php page. All that works fine, but what if I want that new page to be an https page?

If I use a fully qualified header to open that, such as

header(‘Location: ’ . https://domain/members/usermain.html.php’);

I lose the variables unless I set them to session variables, correct? So do I need to use session variables in that case and use the header or is there some way using an include, like

include filedirectory/includes/error.html.php’

to make the include render as an https page?

Thanks for the input. Acutally you can access variables from a php script calling another php page that builds the html page if you use an include. That’s the problem I was having. It works fine except that it takes the http value of the calling page because there is no new header sent. So if the last page called was an https page, then the new include will be that also.

Anyhow, thanks again. As you said, the way to do it is with session vars so I am making that change.

Any variable declared in one request cant be accessed by script from other request, except if value from that variable is written somewhere (Session, Cookie, Db, File … or any other type of storage)

You have to write it somewhere in order to use it in other request.

Basically, when interpreter comes to an end , all variables declared during request are released, they should be released unless there is some memory leak, and that is the reason why we have Session, Cookies, Db etc. or you can send them trough query string when redirecting to another page.