Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2006, 10:24 AM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default daatbase

hi friend

how to pass variables between 2 forms pages
my version is php5
pls give the syntaz of earlie version also

regards
deepak



dee
 
Old April 19th, 2006, 03:20 AM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To pass variables from one page to another you encode the variables in the URL or add to the form information to be submitted (as these two ways are basically how you get from one page to another).

For example, a link on the first page
Code:
<a href="second.php?x=123&amp;y=abc">Go to the second page</a>
will open the second page which will have access to (global) variables $x and $y.

If you submit a form then all its variables are accessible to the second script, for example
Code:
<form action="second.php" method="POST">
<input type="text" name="x" />
<input type="hidden" name="y" value="abc" />
<input type="submit" name="submit" value="Submit!">
</form>
will get the user input to the second script in variable $x and "abc" in variable $y.

Other ways to (more permanently) store user data would be to store it in cookies, session variables or data base.










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.