the year is returned in a URL variable:
&horse_year_foaled=2010
to write the URL variable value to the page, use:
<?php echo(isset($_GET['horse_year_foaled'])?$_GET['horse_year_foaled']:""); ?>
in the WADAtbl_post recordset, you need to include the tbl_posts table in the select statement:
SELECT ads_horses.*,tbl_posts.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.postid ORDER BY adid DESC