tarun Posted December 11, 2006 Share Posted December 11, 2006 when i use this code[code]<?phpif (strstr($file, '.jpg')){echo ('<img src="$file">');}else {echo ('Unknown File Type');}?>[/code]it literrily outputs <img src="$file">lk here to see : http://filehost.awardspace.com/test.php?file=http://www.phpfreaks.com/images/logo_main.jpgwhat wrong wid it???? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 11, 2006 Share Posted December 11, 2006 Switch your use of single and double quotes. Or use concatenation.[code]<?phpif (strstr($file, '.jpg')) echo "<img src='$file'>"; // parenthesis are not needed on an "echo" statementelse echo 'Unknown File Type';?>[/code]or[code]<?phpif (strstr($file, '.jpg')) echo '<img src="' . $file . '">';else echo 'Unknown File Type';?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
tarun Posted December 11, 2006 Author Share Posted December 11, 2006 thnx it works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.