Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a form that will be re-used in different posts.

I also have php code that will be reused to populate the form with the value in the URL.

I tried to use php shortcode and wp php exec, but it doesn't appear to work:

   value = "[exec]echo htmlentities($_GET['source'])[/exec]"

I basically want a simple, reusable way to grab parameters and have it as the value in a hidden field on a form.

share|improve this question
add comment

1 Answer

eval() with insufficiently sanitized input is evil. :-)

share|improve this answer
    
In case the hint wasn't obvious to you: you should be using esc_attr() or esc_html() rather than htmlentities(). –  Denis Nov 11 '10 at 18:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.