0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

Try the following:

<?php
if (isset($_GET['y'])) {
//do this
} elseif (isset($_GET['x'])) {
//do that
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.