I have this php code in a Wordpress page
$str = 's.aspx?sm=Q830I7SJZvuSP3HzDfFlVA%3d%3d';
printf('<a href="https://www.surveymonkey.com/.urlencode($str)." target="_blank">
<img src="http://www.anyfood.gr/net/wp-content/uploads/2014/12/evaluation2.jpg" style="padding:20px;">
</a>'
);
but the link doesn't work, I've tried several possible tricks using single quotes, etc. but I can't figure it out...Any ideas?
Try this, it worked for me:
<?php
$str = 's.aspx?sm=Q830I7SJZvuSP3HzDfFlVA%3d%3d';
printf('<a href="https://www.surveymonkey.com/%1$s " target="_blank"> <img src="http://www.anyfood.gr/net/wp-content/uploads/2014/12/evaluation2.jpg" style="padding:20px;"> </a>', urlencode($str));
?>
Generally you won't have to use urldecode() when accessing GET parameters. Use it as follow:
$str = 's.aspx?sm=' . urlencode ('Q830I7SJZvuSP3HzDfFlVA%3d%3d');
echo '<a href="https://www.surveymonkey.com/'.$str.'" target="_blank">
<img src="http://www.anyfood.gr/net/wp-content/uploads/2014/12/evaluation2.jpg" style="padding:20px;">
</a>';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With