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
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Announcing the TIB 2024 Advent Calendar (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- RISCOSbits releases a new laptop solution (News:)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
- RISC OS London Show Report 2024 (News:1)
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
Acorn Arcade forums: Programming: PHP: new global variables
 
  PHP: new global variables
  Hertzsprung (08:32 29/7/2002)
  alpha (09:09 29/7/2002)
    Hertzsprung (09:34 29/7/2002)
      alpha (12:11 29/7/2002)
        Hertzsprung (12:35 29/7/2002)
          alpha (13:17 29/7/2002)
            Hertzsprung (13:19 29/7/2002)
              alpha (14:32 29/7/2002)
                Hertzsprung (07:57 30/7/2002)
                  alpha (08:32 30/7/2002)
                    Hertzsprung (09:17 30/7/2002)
                      alpha (13:23 30/7/2002)
                        Hertzsprung (13:24 30/7/2002)
                          alpha (13:37 30/7/2002)
 
James Shaw Message #17183, posted by Hertzsprung at 08: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 09: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 09: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 12: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 12: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 13: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 13: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 14: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 07: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 08: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 09: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 13: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 13: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 13: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 ]
 

Acorn Arcade forums: Programming: PHP: new global variables