Click Image, Insert Into Database

Hi,

I have a form which inserts the users ID into ‘follow’ when they submit a form. However I am now trying to change it so the value of the ID is applied to an image. When the user clicks an image their ID is added to the database.

Sounds tricky, can anyone advise how to do this please?


<?php



if(isset($_POST['followform'])) {

    $follow = $_POST['follow'];

$query_follow ="UPDATE users SET follow = '".$_POST['follow']."'" ;
$result_newUser = mysql_query($query_follow);
        $result = mysql_query($query_follow) or die("An error occurred ".mysql_error());


    }
?>
</div>


<form class="followform" method="POST" action="">
<div class="forminputcell">
<div class="datainput">
  <div class="forminputleft">
Follow:
</div>
  <div class="forminputright">
<input   name="follow" type="text" width="10" value="<?php echo $row['id']; ?>" />
</div>
</div>
      <div class="user-area">
      <input type="hidden" name="followform" value="submit" />
<input type="submit" name="submit" value="Submit" class="submit-button" />
  </div>
</div>
</form>