开发者

How do I use PHP to display confirmation tracking code only once w/o using a database?

How do I make it so the tracking code only runs once...and isn't triggered again on a refresh?

I searched but it seems almost always people are saying to use a database...but I was hoping to avoid that....is it possible?

Thanks开发者_JAVA百科

here is the solution for future searchers:

before <HTML> put: <?php session_start(); ?>

Then do this:

<?php
if($_SESSION['check']!=1)
{
$_SESSION['check']=1;
echo '<div class="show">tracking code</div>';}
?> 


There are a number of options available to accomplish this. You can use a flag variable in $_SESSION, you can use in-browser storage with HTML5, or a Javascript DB like http://taffydb.com/. $_SESSION flag variables would probably be the easiest since it doesn't require you to research much more than you already know.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜