Make every date a link like
<a href='writetodatabase.php?date=$date&user=$user'>$date</a>
off course you have to look how to exactly make this link depending on how you make the datelist, this is just an example.
then, writetodatabase.php should look something like
<?php
$date = $_GET['date'];
$user = $_GET['user'];
$connection = mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("database", $connection) or die(mysql_error());
$sql = "insert into table values ('', '$date', '$user')";
mysql_query($sql, $connection) or die(mysql_error());
?>
the empty entry ' ' is a auto_increment in your MySQL table
so you have to create 3 fields there