Forum Moderators: coopster
I am quite new to php, only done a form here and there!
I am trying to have an if statement so that if a particular parameter is passed, the page shows one thing, if its not, it shows nothing.
here is my code
<td>
<?php echo $_GET['subject']; if ( $subject == "#*$!" ){?>
<img src="image.jpg" />
<?php } ?>
</td>
ok, so subject, is being passed through the URL into this page, so if 'subject' = #*$! for example, then I want image.jpg to show if it equals yyy then I want nothing to show.
does that make sense? I just can't get it to work....
many thanks in advance
you have 2 choices
change to this
if ( $_GET['subject'] == "aaa" ){
or assign the value of $_GET['subject'] to $subject
<?php
echo $_GET['subject'];
$subject = $_GET['subject'];
if ( $subject == "aaa" ){
?>
I would also suggest separating lines of code onto separate actual lines, believe me, it will make more sense