I am trying to have a link where a user clicks and triggers a download and a mysql update without visibly leaving the page. Here's what I have so far:
test.php
<body>
<a href="download_update.php?file=music/bash_1.mp3">click here</a>
</body>
download_update.php
<head>
<?
if (isset($file)){
connect()
mysql_query="update blah blah";
header("Location: $file");
}
?>
<meta http-equiv="refresh" content="0;URL=<?print($HTTP_REFERER);?>">
</head>
The problem is that I get this error:
Warning: cannot add header information output already started by download_update.php. I suspect this is becuase I am declaring the tags so the header is being sent before the php is parsed... is there a way around this?