snails07 Posted November 29, 2010 Share Posted November 29, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/220102-preg_match-not-working/ Share on other sites More sharing options...
salathe Posted November 29, 2010 Share Posted November 29, 2010 Why is there a semi-colon on the line with preg_match ? Quote Link to comment https://forums.phpfreaks.com/topic/220102-preg_match-not-working/#findComment-1140797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.