Global variables between pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
samuelmoneill
Forum Newbie
Posts: 2
Joined: Tue Mar 11, 2008 7:52 am

Global variables between pages

Post by samuelmoneill »

Hi am quite new to PHP,

I am building a website using HTML forms PHP and a mySQL database.

I have alot of inter-connected pages using HTML drop-down menus.
Once an option is selected from the menu you are redirected to a new page.
This new page contains PHP code $variable = $_GET['dropdownmenuname']; from the previous page. But I get to a stage where I do this several times and I need the selection variable from the first page to create a mySQL query in the cuurent page.

Firstly you select say "Branch" from "Branch, Client, Owner, Property for Rent, Staff or Viewing. This passes "Branch to a variable $selectDelete.
This then directs you t another page.
This page contains a drop-down menu containing specific options relevent only to previous selection. Say you select "B7". This is passed to another variable $selectRow. Once you select an option from this page it passes variables from the first page say $selectDelete and the second page say $selectRow to a new variable for mySQL $query = delete from $selectDelete where Bno ='$selectRow';

This example is on my website
http://student.cs.ucc.ie/~smon1/dreamho ... delete.php

Is it possible to pass variables like this

Sorry if this is confusing.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Global variables between pages

Post by Christopher »

You can pass them in hidden inputs, or save them in the session.
(#10850)
Post Reply