I have code as
$url = $_GET['q'];
$string = "search_text";
$pos = strpos($url, $string);
Then I use the following to check for the presence of the search_text in the URL. If it is present, I want it to hide the HTML fields
if ($pos !== true) {
// Generate HTML elements
}
However it does not work. Basically, I want to hide certain HTML elements when search_text is present in the URL using the '===' operator for comparing the $pos generated during the strpos operation.
$pos!==true is exactly the opposite of what you want to test for: strpos() will never return true, but either a number or false.
Use
if ($pos === false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With