How can I reuse the code to capture a param in a URL and place in a value in a hidden form?

eval() with insufficiently sanitized input is evil. 🙂