[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] php3 / php4 vars - Submitted form doesn't work
From:       Philip Olson <philip () cornado ! com>
Date:       2002-05-29 15:00:42
[Download message RAW]


> So my question is : Are there differences between 
> PHP3 and PHP4, in the manner of passing variables to 
> a script ???

Sort of.  There are many factors for using data from 
outside of PHP, such as forms.  For example, let's 
assume:

  <form method="GET" action="test.php">
    <input type="text" name="foo" value="bar">
    <input type="submit" name="submit">
  </form>

Within test.php will be our information, but how 
do we access 'foo' = 'bar' information?  Good 
question, many ways exist, such as:

  // Works since PHP 3
  print $HTTP_GET_VARS['foo'];

  // Works since PHP 4.1.0
  print $_GET['foo'];

  // Works if the PHP directive register_globals 
  // is ON, which has been default to off since 
  // PHP 4.2.0
  print $foo;

Most likely you are trying to access $foo while 
register_globals = off.  You may want to discuss 
this topic a little with your host, and ask them 
to turn register_globals back on until everyone 
is happy/ready for this major change.

Is there such a thing as register_globals_runtime()?
Nope.  But you can (if host allows) use .htaccess to 
modify such directives.  Also consider the functions 
extract() and/or import_request_variables() too.  I 
did post a _version_ of doing this at runtime here:

  http://bugs.php.net/bug.php?id=17428

It might help too.  Also read:

  http://www.php.net/manual/language.variables.predefined.php

Regards,
Philip Olson




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About MARC | Support MARC | Got a list to add? | Sponsored by 10East and KoreLogic