Hi,
I am wondering if there is a way to check if a url has an $_GET[] attached to it.

I would like to:

1- Send the url from a search option in the site through the url.
However the search page can search 3 different things, "X", "Y", "Z".
if the "X" is searched the id of the result will be passed through the url (GET). EG: www.site.com?X=21
But if "Y" is searched then the url will be EG: www.site.com?Y=45

So my question is:
Is there a way in php that I can check if a url contains a certain variable. Like some kind of if statement?
EG: if(Y exists){ do this}
elseif(X exits){do this}
etc.

I hope this makes sense and someone can help.

Cheers,

QWaz

Try the following:

<?php
if (isset($_GET['y'])) {
//do this
} elseif (isset($_GET['x'])) {
//do that
}
<?php

print_r($_GET); 

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.