Skip to main content
Participant
October 6, 2007
Question

PHP IF statement problem

  • October 6, 2007
  • 2 replies
  • 286 views
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
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

bitmapboyAuthor
Participant
October 10, 2007
Thank you
Inspiring
October 6, 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/