this is the link
<a href="link_n" onclick="javascript:doLogLink(n)"> link_n</a>
this is the javascript
<head>
<script language="JavaScript">
<!-- Begin
closetime = 6; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*100);
}
function doLogLink(link_n) {
url = "update.php?user=user_name&link_n="+link_n;
width = 250; // width of window in pixels
height = 150; // height of window in pixels
delay = 2; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
</script>
</head>
this is update .php
require("connectmysql.php");
$get_links=mysql_query("SELECT links FROM `link_log` WHERE user='$user'") or die('ok?');
$links=mysql_fetch_array($get_links);
$updated = "$links[0] , $link_n";
$log_update=mysql_query("UPDATE `link_log` SET links='$updated' WHERE user='$user'") or die("I'm not good enough");
echo "Processing ... <br>Please whait";
the javascript and link should be in the same document