I know it has to be waaay super easy, but I can't find the opperator for "contains" in the docu via php.net. Searched the forum, no luck. if($_SERVER['REQUEST_URI'] -contains- "blahblah.html") { $spit_it_out = "blahblah2.html"; } Code (php):
I don't wuite understand the question, but this might work: $ref=@$HTTP_REFERER; Switch($ref){ case "http://www.yoursiteurl.com/music": header("Location: http://www.yoursiteurl.com/music/sent.html"); exit; break; case "http://www.yoursiteurl.com/movies": header("Location: http://www.yoursiteurl.com/movies/sent.html"); exit; break; case "http://www.yoursiteurl.com/cars": header("Location: http://www.yoursiteurl.com/cars/sent.html"); exit; break; } Code (markup): another way of doing it would be to put a hidden input with the URL as its value, and when the user submits the form you could just check the value of that field and redirect to the appropriate page.
I edited the OP to clarify the question a little better. I don't want to use full URLs, basically all I need is the refering page, not the path. I'll explore that, it's probably a lot easier/more stable.
Simplest indeed is strpos, which will return false if it's not in there. I use this wrapper function for this: <?php function str_contains($haystack, $needle, $ignoreCase = false) { if ($ignoreCase) { $haystack = strtolower($haystack); $needle = strtolower($needle); } $needlePos = strpos($haystack, $needle); return ($needlePos === false ? false : ($needlePos+1)); } ?> PHP: That way, in your example, it's literally: if(str_contains($_SERVER['REQUEST_URI'], "blahblah.html") { $spit_it_out = "blahblah2.html"; } PHP: