What you may want to do is add the info to a URL query string on each link, then get the values from the $GET array on the target page:
printf("<td><a href='change_trainer.php?HorseName=%s&TrainerName=%s'>",
urlencode($row['HorseName']), urlencode($row['TrainerName']));
Then when the user clicks a given link, in change_trainer.php the values will be available in $_GET['HorseName'] and $GET['TrainerName'] (and if desired, you could assign them to $SESSION elements at that point).