Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 June 12th, 2003, 08:27 AM
Registered User
Join Date: Jun 2003
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
Old June 19th, 2003, 02:11 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

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,


Similar Threads
Thread Thread Starter Forum Replies Last Post
global variables Komila ASP.NET 3.5 Basics 2 October 31st, 2008 01:14 PM
Global Variables in C# su C# 2 December 11th, 2006 06:18 PM
Global variables zarol Beginning PHP 3 May 10th, 2005 06:17 AM
Global Variables in .NET mbmsecret C# 5 July 6th, 2004 02:27 AM
Global variables ps124 ASP.NET 1.0 and 1.1 Basics 6 April 6th, 2004 02:48 PM

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