Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP IF statement problem

New Here ,
Oct 06, 2007 Oct 06, 2007
I want to echo an image inside of this, instead of text. But cannot get it to work. Any ideas?

<?php if (isset($HTTP_GET_VARS['status']) && $HTTP_GET_VARS['status'] == "true") echo ("<img src="images/added.jpg">); ?><?php if (isset($HTTP_GET_VARS['status']) && $HTTP_GET_VARS['status'] == "false") print ("You are already added!"); ?>

Thanks
TOPICS
Server side applications
280
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 06, 2007 Oct 06, 2007
bitmapboy wrote:
> <?php if (isset($HTTP_GET_VARS['status']) && $HTTP_GET_VARS['status'] ==
> "true") echo ("<img src="images/added.jpg">); ?><?php if
> (isset($HTTP_GET_VARS['status']) && $HTTP_GET_VARS['status'] == "false") print
> ("You are already added!"); ?>

Your use of quotes in the echo statement is wrong. Should be this:

echo '<img src="images/added.jpg">';

Also, you should not be using $HTTP_GET_VARS unless you're using a very
old server. $HTTP_GET_VARS is deprecated and won't work on all servers.
Use $_GET instead. See the following section of the PHP manual for more
details:

http://www.php.net/manual/en/reserved.variables.php

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 10, 2007 Oct 10, 2007
LATEST
Thank you
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines