function for variable in url

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
JosiaMFire22
Forum Newbie
Posts: 9
Joined: Thu Oct 12, 2006 1:12 am

function for variable in url

Post by JosiaMFire22 »

Hey, I was wondering if anyone could tell me the name of the function that allows you to have like a variable on the end or ur url (eg. http://www.domainhere.com/profile.php?id=JosiaMFire2) - variable would be "JosiaMFire2".
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

It's not a function, it's the GET superglobal array.
JosiaMFire22
Forum Newbie
Posts: 9
Joined: Thu Oct 12, 2006 1:12 am

Post by JosiaMFire22 »

kk, thanks heaps, im still a newb :oops:
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: function for variable in url

Post by RobertGonzalez »

JosiaMFire22 wrote:Hey, I was wondering if anyone could tell me the name of the function that allows you to have like a variable on the end or ur url (eg. http://www.domainhere.com/profile.php?id=JosiaMFire2) - variable would be "JosiaMFire2".

Code: Select all

<?php
$id = $_GET['id'];

// For a little cleaner approach
$id = isset($_GET['id']) ? $_GET['id'] : '';
?>
Post Reply