Jump to content

preg_match not working


snails07

Recommended Posts

here is my code below

 

PHP Code:

<?php

    $referer = $_SERVER['HTTP_REFERER']; 

    
    if (preg_match('/\/search\//', $referer)); {?>
<p><a href="javascript:history.back(-1);">Previous Page</a></p>

<?php } ?>

 

I am basically trying to say that if the users previous page url contained the word ‘search’ (ie. Coming from the search page) then display the javascript back link.

It displays the link even if the previous page url does not contain the word ‘search’.

What have I done wrong here??

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/220102-preg_match-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.