passing variables from one form to another
Moderator: General Moderators
passing variables from one form to another
Ok, This is a very simple question....
page1.php - has a form that posts to itself and does validation on the fields, if all is well, header location redirects to the next page.
page2.php - another form.. but how do I get the data which was submitted to pass to this page? without appending to the url and without grabbing from the DB..... is there a way when im not posting to this page?
page1.php - has a form that posts to itself and does validation on the fields, if all is well, header location redirects to the next page.
page2.php - another form.. but how do I get the data which was submitted to pass to this page? without appending to the url and without grabbing from the DB..... is there a way when im not posting to this page?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Ok, Maybe im not following... but in my case, where im trying to pass the data... how would a superglobal help? as GET/POST will not work.Everah wrote:register_globals should be off, and no, that directive will not affect $_GET, $_POST etc superglobals. You should be using the superglobals even if register_globals is on.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: passing variables from one form to another
page1.php - First load do nothing but show a form. On submit, the form data will be in the $_POST superglobal array. Use that data to set session vars so they will be availble to the page that you redirect to... or send them by query string and ....GeXus wrote:Ok, This is a very simple question....
page1.php - has a form that posts to itself and does validation on the fields, if all is well, header location redirects to the next page.
page2.php - another form.. but how do I get the data which was submitted to pass to this page? without appending to the url and without grabbing from the DB..... is there a way when im not posting to this page?
page2.php - Use either the $_SESSION superglobal (if you set session vars) or the $_GET superglobal if you passed the data by URI to fetch what was passed to this page and use that data in your second form.
Re: passing variables from one form to another
Perfecto.. Thank You!Everah wrote:page1.php - First load do nothing but show a form. On submit, the form data will be in the $_POST superglobal array. Use that data to set session vars so they will be availble to the page that you redirect to... or send them by query string and ....GeXus wrote:Ok, This is a very simple question....
page1.php - has a form that posts to itself and does validation on the fields, if all is well, header location redirects to the next page.
page2.php - another form.. but how do I get the data which was submitted to pass to this page? without appending to the url and without grabbing from the DB..... is there a way when im not posting to this page?
page2.php - Use either the $_SESSION superglobal (if you set session vars) or the $_GET superglobal if you passed the data by URI to fetch what was passed to this page and use that data in your second form.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
page1.php - has a form that posts to itself and does validation on the fields, if all is well, header location redirects to the next page.
Code: Select all
header('Location: http://someurl.com/page2.php?data=toBeSavedAsGet');