Jump to content

POST and GLOBAL Variables


danhere

Recommended Posts

I have a form and the variables are you know $_POST[variables] and stuff. I need them to be echoed some where else in another step through another form. So if you click "submit" they all echo on the next page so the user can check there data. Then it asks to complete so then it goes through again. Should they stay the same? Like can I just call them as $_POST variables or do I need to change the POST variables to GLOBAL variables? Or something else I'm not getting?

I have :

$cosign = $_POST[cosign]; 
$coadd = $_POST[coadd];
$cocity = $_POST[cocity];
$costate = $_POST[costate];

 

Now should I change those variables like I did to GLOBALS? Or can they stay that way or ?

Link to comment
https://forums.phpfreaks.com/topic/112036-post-and-global-variables/
Share on other sites

beat me to it...but here is my 2 cents still:

 

GLOBAL variables won't carry from page to page. they disappear after the script finishes generating a page.

 

there are two options:

-the most common is to use a SESSION and store the values in there. http://us2.php.net/manual/en/session.examples.php

-the other is to have another form on the second page, and put all the values as hidden input elements. then, when they click FINISH on the second page, it submits the form to the third page

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.