| Gabriel De Rezende E Lamounier 2004-04-12, 1:33 pm |
| Em Sex 02 Abr 2004 23:10, Scott E Foulk escreveu:
> Aloha,
> =A0 =A0 =A0 I am using apache on my laptop to emulate my online database =
and
> site and wondering about 2 things:
>
> 1 - I'm not able to pass variables between pages in PHP
> =A0=A0=A0=A0=A0=A0e.g. On page1.php I have a field named in_company, whic=
h, on the
> website my client is hosted from passes into the next page as $in_company.
> But on my self-configured Apache/PHP/MySQL laptop setup, the variables
> come up as undefined on the follwing page.
your original server must have been configured with "register_globals=3D0n"=
on=20
php.ini and on you laptop it must be set "register_globals=3DOff" wich is t=
he=20
defalt.
setting register_globals on enables you to pass in_company as $in_company, =
but=20
if it's set off trying to access the value of in_company directly as=20
$in_company will fail. it's because when register_globals is on it=20
automatically assign the value of a passed variable to a variable of the sa=
me=20
name in the php script.
> The queries with MySQL work=20
> nicely, but not without variable passing. =A0I don't like to append on to
> the URL as some vars I like to keep low profile.
> =A0 e.g.
> http://www.mysite.com?var_0=3D5&var...restuff&etc=3D=
more
>
if register_globals is off, this assignment dosn't happen automatically, so=
=20
you must first do:
$in_company =3D $_GET['in_comany']
or
$in_company =3D $_POST['in_company']=20
depending on the method you're using.
remember that relying on register_globals been set as on is not a good=20
practice.
gabriel
|