I have a simple problem! I am not very well versed in PHP, JAVA is my cup of cofee... Any way, what I am trying to do (using PHP) is simple I would like to get the URL of the page and store it in a variable. I would then like to search the variable for a string e.g If I have a domain www.somedomain.com/somepage.php Then I would like to store in in $somevariable I would then like to check $somevariable for the string 'somepage' can anyone help!!!!
does this work for you? $path=$_SERVER["PHP_SELF"]; PHP: ok now to check for the string somepage....checking.... $somepage="document"; if (strpos($path,$somepage)!=0) echo "Found it."; PHP: does that work? I don't work with strings much and I'm something of a php newbie myself... If it doesn't work, I'm sure rvarcher or JD or Shawn will clear things up for you.
If $somepage is found at the beginning of $path, strpos() will return 0. You need to check for false with the type-sensitive equality operator. $somepage="document"; if (strpos($path,$somepage)!==false) { echo "Found it."; } PHP: