Ok, so I have this php code that tracks external referrals: <? $domain = 'YourDomain.com'; $file = "referral_tracker.html"; $ref = $_SERVER['HTTP_REFERER']; $thisDomain = strpos($ref, $domain); if ($thisDomain === false) { if ($ref == '') { $ref = 'UnknownLocation'; } $saveRef = true; } else { $saveRef = false; } if ($saveRef == true) { $to = $ref; $fp = fopen($file, "r"); $gf = fread($fp, filesize($file)); fclose ($fp); $arr = explode("<br />", $gf); $n = ""; foreach ($arr as $line) { $line = trim($line); if ($line != "") { $sub = explode(" ", $line); if ($to == $sub[0]) { $tracked = true; $sub[1]++; } $n .= $sub[0] . " " . $sub[1] . "<br />"; } } if ($tracked != true) { $n .= $to . " 1<br />"; } $fp = fopen($file, "w"); fputs($fp, $n, strlen($n)); fclose($fp); } ?> Code (markup): I want to put this html into the script so that it looks organized: <div style='border: 3px dotted #0af; font-family: Tahoma; padding: 20px; padding-top: 0; font-size: 12px; background-color: #fafafa; margin: 50px;'><p><h2>REFERERERS (NEWEST FIRST)</h2></p> Code (markup): I tried putting that into the referral_tracker.html file but whenever a new referral is added, the div style information is reset. Can anyone help me with this, I would be very appreciative. Thanks in advance.
YOu need to add the code to your PHP script instead of the html file, coz the script writes the new information to the same file. for example add this fputs($fp, '<div style="border: 3px dotted #0af; font-family: Tahoma; padding: 20px; padding-top: 0; font-size: 12px; background-color: #fafafa; margin: 50px;"><p><h2>REFERERERS (NEWEST FIRST)</h2></p>'); Code (markup): somewhere in the beginning after fopen