global variables

I am looking to use input from a form on later pages.

I use the following code at the beginning of each page file:

<?php session_start(); session_register('incity', 'outcity', 'inmonth', 'inday', 'inyear', 'outmonth', 'outday', 'outyear', 'tickets'); ?>

The problem is that sometimes the variables pass thru without a problem, but most of the time it doesn’t work (usually the first variables don’t pass at all).

Any help or explanation?


I am not sure if this is your problem, but the way you are trying to do it is depreciated.

Try something like:


<? session_start(); $_SESSION['incity']; $_SESSION['outcity']; $_SESSION['inmonth']; $_SESSION['inday']; $_SESSION['inyear']; $_SESSION['outmonth']; $_SESSION['outday']; $_SESSION['outyear']; $_SESSION[' tickets']; ?>


Be sure to use session_start on ever page that you are using the session variables!

Thanks for the reply but even with the more conventional method it still didn’t work.

What’s so strange is that:

  1. the variables pass sporacically with no rhyme or reason as to when it will work or won’t work
  2. the same exact files on one server work (most of the time) but on another they never work. Both have global variables ‘on’.

I’m sure it’s something easy but beyond my abilities. If there are any php experts out there i’d be willing to zip/email them the files innvoved to see if they can ‘fix’ it.


I have a feeling I know what your problem is. Send me the code.

[Tarential] at [].

Sponsor our Newsletter | Privacy Policy | Terms of Service