View Single Post
  #1 (permalink)  
Old June 12th, 2003, 08:27 AM
tenikiwon tenikiwon is offline
Registered User
Join Date: Jun 2003
Location: Oshkosh, WI, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to tenikiwon Send a message via MSN to tenikiwon
Default 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
Reply With Quote