How do I pull in the listID using a variable?

I want to add http://www.mysite.com/test2.php?uid=$uid&listid=$listid to the footer of all my emails. I cannot figure out how to pull in the listid for this querystring. Any and all help appreciated!