Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
getting actual string from _GET
Old 03-23-2009, 06: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
 
 
Register now for full access!
Old 03-23-2009, 06: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, 06:54 PM Re: getting actual string from _GET
lizciz's Avatar
Webmaster Talker

Posts: 744
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']?
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 03-23-2009, 07: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, 07: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

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 03-24-2009, 02:21 AM Re: getting actual string from _GET
NullPointer's Avatar
Will Code for Food

Posts: 2,781
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
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-24-2009, 02: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

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
dark_lord is offline
Reply With Quote
View Public Profile Visit dark_lord's homepage!
 
Old 03-24-2009, 05:03 AM Re: getting actual string from _GET
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
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.26630 seconds with 12 queries