I've made this block of code:
$tag = $_GET['tag'];
if ($_SERVER[HTTP_REFERER'] == 'http://sitename.com/portfolio' || $_SERVER['HTTP_REFERER'] == 'sitename.com/tags/?tagname=' . $tag ) : ?>
<figure class="folio-item">
<img src="<?php echo $mod->src; ?>" alt="">
</figure>
<?php else : ?>
<?php header('http://sitename.com/portfolio'); ?>
<?php endif ?>
So if the statement is true it has to make the figure, which does work. but when the statement isn't true it gives me a empty file instead of heading me to sitename.com/portfolio
how can i make this work?
the Solution:
$tag = $_GET['tag'];
if ($_SERVER[HTTP_REFERER'] == 'http://sitename.com/portfolio' || $_SERVER['HTTP_REFERER'] == 'sitename.com/tags/?tagname=' . $tag ) : ?>
<figure class="folio-item">
<img src="<?php echo $mod->src; ?>" alt="">
</figure>
<?php else : ?>
<?php header('Location:http://sitename.com/portfolio'); ?>
<?php endif ?>
I added Location: to the header function like Brian said.