log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Upgrading your RISC OS system to 5.30 (News:2)
- WROCC May 2024 meeting on wednesday - Gerph talks games (News:)
- Wakefield Show 2024 in Pictures (News:4)
- RISC OS 5.30 arrives (News:1)
- April 2024 News Summary (News:1)
- uniprint upgraded to 4.50 (News:)
- PhotoDesk 3.23 released (News:)
- R-Comp reveals N.Ex.T Boxes - the successor to the i.MX6 (News:)
- RISCOSbits at Wakefield Show 2024 (News:)
- R-Comp releases Genealogy v2 (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Programming: PHP: new global variables
 
  PHP: new global variables
  Hertzsprung (09:32 29/7/2002)
  alpha (10:09 29/7/2002)
    Hertzsprung (10:34 29/7/2002)
      alpha (13:11 29/7/2002)
        Hertzsprung (13:35 29/7/2002)
          alpha (14:17 29/7/2002)
            Hertzsprung (14:19 29/7/2002)
              alpha (15:32 29/7/2002)
                Hertzsprung (08:57 30/7/2002)
                  alpha (09:32 30/7/2002)
                    Hertzsprung (10:17 30/7/2002)
                      alpha (14:23 30/7/2002)
                        Hertzsprung (14:24 30/7/2002)
                          alpha (14:37 30/7/2002)
 
James Shaw Message #17183, posted by Hertzsprung at 09:32, 29/7/2002
Hertzsprung
Ghost-like

Posts: 1746
I've just had another look at PHP (I used it about six months ago) to find that new "superglobals" have been made, such as $_POST[] and $_SESSION[].

What do people think about these? Should we use them yet (becuase they are quite new), or should we assume that register_globals is set in php.ini?

I see this as a move towards the ASP way of doing things - I believe ASP has always had such variables?
  ^[ Log in to reply ]
 
Tim Fountain Message #17195, posted by alpha at 10:09, 29/7/2002, in reply to message #17183
Forum bod
Posts: 570
If you're using PHP >= 4.1.0 then use the super globals. It's good to get in the habit :)
  ^[ Log in to reply ]
 
James Shaw Message #17204, posted by Hertzsprung at 10:34, 29/7/2002, in reply to message #17195
Hertzsprung
Ghost-like

Posts: 1746
Do web servers tend to have the register_globals param configured for this?
  ^[ Log in to reply ]
 
Tim Fountain Message #17234, posted by alpha at 13:11, 29/7/2002, in reply to message #17204
Forum bod
Posts: 570
The default setting for register_globals in PHP >4.2.0 is off, so yes. The super global arrays will always be present if you're running >4.1.0.
  ^[ Log in to reply ]
 
James Shaw Message #17238, posted by Hertzsprung at 13:35, 29/7/2002, in reply to message #17234
Hertzsprung
Ghost-like

Posts: 1746
So the superglobal arrays still exist in <4.2.0, alongside the global variables automatically created?
  ^[ Log in to reply ]
 
Tim Fountain Message #17242, posted by alpha at 14:17, 29/7/2002, in reply to message #17238
Forum bod
Posts: 570
The super global arrays were introduced in PHP 4.1.0, so they don't exist in versions before that. The other global variables are depreceated as of 4.2.0 I think.
  ^[ Log in to reply ]
 
James Shaw Message #17243, posted by Hertzsprung at 14:19, 29/7/2002, in reply to message #17242
Hertzsprung
Ghost-like

Posts: 1746
IMHO, they should have been introduced a long long time ago.
  ^[ Log in to reply ]
 
Tim Fountain Message #17248, posted by alpha at 15:32, 29/7/2002, in reply to message #17243
Forum bod
Posts: 570
It's a better system, yes; but there were equivalents before - $HTTP_COOKIE_VARS etc.
  ^[ Log in to reply ]
 
James Shaw Message #17275, posted by Hertzsprung at 08:57, 30/7/2002, in reply to message #17248
Hertzsprung
Ghost-like

Posts: 1746
Changing the subject slightly - does anyone know how the data is received from a MULTIPLE SELECT form control (ie into a PHP array)? I guess its something to do with the HTTP POST gubbins :|
  ^[ Log in to reply ]
 
Tim Fountain Message #17277, posted by alpha at 09:32, 30/7/2002, in reply to message #17275
Forum bod
Posts: 570
If you call the field something like myfield[], then it'll end up in an array called $myfield. Again how you access it depends what version of PHP you're running, but if it's a recent one then you'll find it in $_POST['myfield'].
  ^[ Log in to reply ]
 
James Shaw Message #17278, posted by Hertzsprung at 10:17, 30/7/2002, in reply to message #17277
Hertzsprung
Ghost-like

Posts: 1746
I realise that, but I am wondering how it works behing the scences - what data is posted? How is the SELECT MULTIPLE control's data sent?
  ^[ Log in to reply ]
 
Tim Fountain Message #17303, posted by alpha at 14:23, 30/7/2002, in reply to message #17278
Forum bod
Posts: 570
I'm not exactly sure what you're asking. The select multiples will be submitted in the same way as any other form post data, but if you include square brackets on the end of the field name PHP can turn the info into an array.
  ^[ Log in to reply ]
 
James Shaw Message #17304, posted by Hertzsprung at 14:24, 30/7/2002, in reply to message #17303
Hertzsprung
Ghost-like

Posts: 1746
Is there a way (in Javascript) to fake a SELECT MULTIPLE control?
  ^[ Log in to reply ]
 
Tim Fountain Message #17307, posted by alpha at 14:37, 30/7/2002, in reply to message #17304
Forum bod
Posts: 570
My javascript knowledge is very basic, but I wouldn't have thought you could do that.
  ^[ Log in to reply ]
 

The Icon Bar: Programming: PHP: new global variables