Skip to content
WJunction - Webmaster Forum

PHP Help needed

Status
Not open for further replies.

cgworld

Experienced Member
566
2010
9
So let's say
$url = "http://mysite/index.php?page=down&do=search&key=0-9"

How to say if "index.php?page=down&do=search&key" all those vars are set ($_GET) then do somethn ?
 
Last edited:

5 comments

You can do something along these lines

$url="your url";
$findme = 'what your searching for';
$pos = strpos($url, $findme);

if ($pos === false) {
echo "no found!";
} else {
echo "it was found! at position ".$pos;

}
 
if you need it for exactly this url...

if($url=='index.php?page=down&do=search&key'){
//do something...
}

as simple as it gets. ;)
 
A little improvement on the code posted by Bread :

PHP:
$url="your url";
$findme  = 'what your searching for';

if(is_numeric(strpos($url, $findme))) {
   
//Your code here

}
 
Status
Not open for further replies.

About the author

C
Experienced Member · Joined
566
Messages
9
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom