Reply
getting actual string from _GET
Old 03-23-2009, 05:39 PM getting actual string from _GET
melefire's Avatar
Experienced Talker

Posts: 46
Name: matt
Trades: 0
So i have urls structured like this:

example.com/info.php?a99dm

now the last part(a99dm) is what i need to view in my script. is to possible to get this data?
melefire is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 03-23-2009, 05:46 PM Re: getting actual string from _GET
Novice Talker

Posts: 9
Name: Dan
Trades: 0
Mistaken advice. - Disregard post
DLaManna is offline
Reply With Quote
View Public Profile
 
Old 03-23-2009, 05:54 PM Re: getting actual string from _GET
lizciz's Avatar
Ultra Talker

Posts: 430
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I'm not sure that's possible (I'm not saying it can't be done, just that I dont know of a way) because that would normally be the variable name, not it's value, as in
$_GET['a99dm'] = '...';

When you have info.php?a99dm the variable is not getting any value, so I doupt you could check it with isset(), but It wouldn't hurt to try. Otherwise, can you not simply use info.php?my_var=a99dm and retrieve it through $_GET['my_var']?
__________________
49206368616e676564206d79207369676e61747572652e2049 2062657420796f75206469646e5c2774206e6f7469636521
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 03-23-2009, 06:08 PM Re: getting actual string from _GET
melefire's Avatar
Experienced Talker

Posts: 46
Name: matt
Trades: 0
thanks but i got it to work using explode
melefire is offline
Reply With Quote
View Public Profile
 
Old 03-23-2009, 06:17 PM Re: getting actual string from _GET
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
Still probably advisable to do it the "proper" way. Technically that's a malformed URL.
__________________
Will Anderson
It's An Anderson | Twitter | Anderson Web Solutions
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 03-24-2009, 01:21 AM Re: getting actual string from _GET
NullPointer's Avatar
Will Code for Food

Latest Blog Post:
Apparatus Update Preview
Posts: 1,169
Name: Matt
Location: Irvine, CA
Trades: 0
You would probably be better off passing parameters the proper way and using mod rewrite to format your URLs
__________________
Tinsology | How to Post Code | RosettaCodex
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-24-2009, 01:26 AM Re: getting actual string from _GET
dark_lord's Avatar
Experienced Talker

Posts: 41
Name: Parijat Roy
Location: INDIA-KOLKATA
Trades: 0
yes it can be done.
the proper way is like this
PHP Code:
<?php
$vars 
$_GET;
function 
isreq($str)
{
    
$req "a.p.b.g";
    
$pos strpos($req$str);
    if(
$pos===false)
    {
        return 
false;
    }
    return 
true;
}
foreach (
$vars as $var => $val)
{
    if (!
isreq($var))
    {
        
$uid $var;
        break;
    }
}
echo 
"$uid";
?>
that $uid will be the last part.
__________________
I AM THE BEAUTIFUL NIGHTMARE
Dark_Lord's Personal Blog | Wrap up your big url
dark_lord is offline
Reply With Quote
View Public Profile Visit dark_lord's homepage!
 
Old 03-24-2009, 04:03 AM Re: getting actual string from _GET
chrishirst's Avatar
Super Moderator

Posts: 26,421
Location: Blackpool. UK
Trades: 0
Actually you can retrieve a value from the URI that is defined as a parameter name only

PHP Code:
$value key($_GET); 
will return the keyname of the first parameter in the querystring.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to getting actual string from _GET
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10205 seconds with 13 queries