p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning PHP (http://p2p.wrox.com/forumdisplay.php?f=95)
-   -   Maintaining Global variables (http://p2p.wrox.com/showthread.php?t=479)

tenikiwon June 12th, 2003 08:27 AM

Maintaining Global variables
 
I've been working on a form/subform combination.
When you first call the page you get a dropdown box for the customers.
After picking the customer and clicking GO it brings up the customer form and displays the customers information. From there you can update the customer information by clicking on another button.

My problem comes in when I want to display a subform for the customer. In this case. Each customer can have several sites. I can bring up another drop down box that displays the sites for the customer, but when I what to select the site (by Clicking another GO button) it looses the global I have setup for the customer ID.

Here's a brief of what I've tried.
1 > Two files customer.php and site.php. Lost value when switching forms.
2 > Functions customer() and site() using two different switch functions.

I should add that my stucture is similar to this...
function update_customer() <--used when customer alreay exsits
function save_customer() <--used when adding a customer
function get_customer() <---Runs the query and returns the data
function customer_form(results from get_customer) <--form's format
and the same setup for customer_site with two switch functions $site and $customer.
I've also read about using the $gobals["variable"] but think I don't fully understand it.

What is the best way to accomplish a form/subform connecting to a MySQL database?

Thanks in advace.

Andrew J. Nowicki

nikolai June 19th, 2003 02:11 PM

I don't fully understand what you're trying to do... it sounds like you want to maintain variable state across multiple page requests. If so, use sessions.

If I'm not getting your drift, please re-explain your problem.


Take care,

Nik
http://www.bigaction.org/


All times are GMT -4. The time now is 07:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.