![]() |
|
#1
|
|||
|
|||
PHP variablesLets say you have "something.php?mode=newhatever&blah=545"
How do you get the mode and blah variables out, is it easy? I know that using javascript you have to use a split method and a bunch of arrays, is it similar, or simpler? Nick |
|
#2
|
|||
|
|||
|
I know this has been here for ages, and I only joiined yesterday, but I'll reply anyway. Just in case someone else has this problem.
The biggest advantage of PHP is the way that it handles variables, passed from one page to another. Put simply, your query string "something.php?mode=newhatever&blah=545" will create new variables in something.php called $mode - which contains "newhatever" $blah - contains "545" It's that easy. Then you can do what you want to these variables from the start of something.php. Don't you just love Open Source! Garth Farley |
|
#3
|
|||
|
|||
|
so you can then do something like:
echo"$mode"; and it will display: newwhatever __________________
Andrew |
|
#4
|
|||
|
|||
|
Yup. Have a space between echo and the quote.
This should work too: echo $mode; Garth Farley |
|
#5
|
||||
|
||||
|
With php 4.2.1 it's now
PHP Code:
and they're superglobals, so they exist even in functions and classes! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
|||
|
|||
|
Yeah, that's been done for security reasons. There is a setting in PHP.ini that allows you to use the easier (if not a little more dangerous) variables. I think it's register_globals.
Garth Farley |
|
#7
|
||||
|
||||
|
Quote:
I just discovered that recently, couldn't figure out why PostNuke would not get past the first page of the installer on php 4.2.1 when it was perfect on 4.0.6 No choice but to use the register_globals workaround :-? So much for upgrades NickBeee |
|
#8
|
||||
|
||||
|
php 4.2.2 has been released as a security update.
http://www.php.net |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error Pages | BobbyDouglas | MySQL / PHP Forum | 118 | 17-Mar-2004 04:18 |
| Optimizing your web server with Turck MMCache for PHP | JdS | Web Hosting Forum | 2 | 07-Jan-2004 07:48 |
| apache2 - php cgi fehler - schleife | inna | Apache Web Server Forum | 8 | 27-Nov-2003 09:55 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 08:40 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The