example.php?property=value
I only want to echo the $_GET property, not the value but when I do echo $_GET PHP echos an array (which I can understand) but I'd like it to just echo property in this instance, how do I achieve that?
Echo $_GET property, NOT value?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Echo $_GET property, NOT value?
Code: Select all
foreach ($_GET['property'] as $value) {
echo $value;
}(#10850)
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: Echo $_GET property, NOT value?
Err thanks but I think I should have clarified that I'm using the term 'property' only to reference the first part of a set in the query so 'property' could be anything (fruit, magazine, animal, etc).
example.php?animal should echo animal
example.php?ocean should echo ocean
example.php?property should echo property
example.php?animal should echo animal
example.php?ocean should echo ocean
example.php?property should echo property
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Echo $_GET property, NOT value?
Code: Select all
$properties = array_keys($_GET);
foreach ($properties as $property) {
echo $property;
}(#10850)