I want to add some PHP code (to read out URL variables via get_query_var) in the content area of a Wordpress page. To do that I use the following function in my functions.php
function php_execute($html){
if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter('the_content','php_execute',100);
With this, I'm able to read out a URL variables of my URL /thank-you/?order_id=ABCDE
with <?php echo get_query_var( 'order_id' );?>
.
Now I want to add this order ID to a URL (in order to prefill a field in a survey) and tried to add it to the corresponding URL like so:
<iframe src="https://XXX.wufoo.com/embed/YYYYY/def/field414=<?php echo get_query_var( 'order_id' );?>"> <a href="https://XXX.wufoo.com/forms/YYYYY/def/field414=<?php echo get_query_var( 'order_id' );?>">Link to survey</a>
Unfortunately the resulting source code looks like this:
<iframe src="https://XXX.wufoo.com/embed/YYYYY/def/field414=ABCDE „> <a href="https://XXX.wufoo.com/forms/YYYYY/def/field414=ABCDE „>">Link to survey</a>
So instead of field414=ABCDE">
it says field414=ABCDE „>
I'm very new to PHP and think that there might be a problem in the function but can't figure it out.
Does anyone see a mistake somewhere?
Thanks, Patrick