Jump to content

Confusing behavior from print and echo


spoofer26

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.