spoofer26 Posted April 9, 2006 Share Posted April 9, 2006 Hi, im not technically a novice at PHP but since my problem involves printing to the browser i guess this is the place.can anyone explain why this:[code]<?php$test="img_id=2";echo "<a href='http://gamersphere.com/topclans/index.php?vote=418' target='_blank'><img src='http://gamersphere.com/topclans/index.php?".$test."&img=418' border='0'></a>";?>[/code]Outputs this:[code]<a href='http://gamersphere.com/topclans/index.php?vote=418' target="_blank"> </a>[/code](ie, for some reason the <img> tag is being turned to whitespace by the php parser).Is this expected behavior? it makes absolutely no sense to me. Link to comment https://forums.phpfreaks.com/topic/6941-confusing-behavior-from-print-and-echo/ Share on other sites More sharing options...
kenrbnsn Posted April 9, 2006 Share Posted April 9, 2006 I just tried your code. It works fine for me. Here is the HTML source generated:[code]<a href='http://gamersphere.com/topclans/index.php?vote=418' target='_blank'><img src='http://gamersphere.com/topclans/index.php?img_id=2&img=418' border='0'></a>[/code]You can see it in action at [a href=\"http://localhost/kenrbnsn/phpfreaks/quest.php\" target=\"_blank\"]http://localhost/kenrbnsn/phpfreaks/quest.php[/a]Ken Link to comment https://forums.phpfreaks.com/topic/6941-confusing-behavior-from-print-and-echo/#findComment-25210 Share on other sites More sharing options...
spoofer26 Posted April 9, 2006 Author Share Posted April 9, 2006 thanks ken, perhaps my php install has gone whacko. What version of PHP are you running? Link to comment https://forums.phpfreaks.com/topic/6941-confusing-behavior-from-print-and-echo/#findComment-25213 Share on other sites More sharing options...
kenrbnsn Posted April 9, 2006 Share Posted April 9, 2006 I tried it on both version 4.3.9 (Linux) and 5.0.5 (Windows XP)Ken Link to comment https://forums.phpfreaks.com/topic/6941-confusing-behavior-from-print-and-echo/#findComment-25216 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.