Using ?fjkdf instead of ?var=djkdf

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Using ?fjkdf instead of ?var=djkdf

Post by phice »

Is there a way? I saw perl/cgi doing it... :/
Image Image
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

yep, i do it all the time. given this URL: .../page.php?some_value
put this code at the top of page.php

Code: Select all

<?php
$variable = $_SERVERї'argv']ї0];
?>
$variable would now equal "some_value"
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

NICE!
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

That's how some website do it :D
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Amazing! :D:D
Image Image
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

im actually kinda stunned that you guys never thought of this. not to be down on you cause im glad to show you new ways of doing things. i just thought it was a common thing but people preferred not to use it.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

I plan on using it... but where can I get more information on _SERVER[""] stuff? I searched on php, and couldnt find anything. :/
Image Image
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

here is a listing of possible $_SERVER[''] values (and all the other $_ variables:
http://www.php.net/manual/en/printwn/re ... iables.php
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

To find out what's accessible to you in the $_SERVER array on your own machine just do:

Code: Select all

<?php
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
?>
'cause it tends to be slightly different for everyone.

Mac
Post Reply