Forum Moderators: coopster
print "<img src=\"http://domain.com/images/" . $icon . ".gif\" />";
however the resulting url is "http://domain.com/images/26%20%20%20%20.gif"
If I remove .gif from the end it prints the proper variable name. Am I using concatenation incorrectly? What am I doing wrong?
Using single quotes around strings might help alleviate some confusion. Try:
echo '<img src="http://domain.com/images/' . $icon . '.gif" />';- it helps you see what's a single quote, and what's a double quote, and 'echo' might be slightly more straightforward (less special funcitonality) than 'print'.
My solution ended up being printf("<img src=\"http://domain.com/images/%s.gif\"/>",htmlspecialchars(trim($icon))); to strip the %20.
Thanks for your help.