Dynamic content not showing within if statement.

This is a question followed on from this solution....

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27489226.html

I am building a booking page which shows different content/prices depending on the user level.

With help from a previous question i'm able to show/hide content depending on these levels.

The problem is that though most of the content shows, the dynamic content does not.

For instance, this...<?php echo $row_Recordset1[memberfee]; ?>

...does not show anything when part of the 'if' code below but when it's pasted elsewhere on the page outside the if statement the dynamic content (in this case prices) shows fine.

I have tried using single quotes, double quotes and no quotes ['memberfee'], ["memberfee"], [memberfee] but these do not make any difference.

I have attached two screenshots to show what show within the if statement and outside it.

Any ideas why this isn't showing?

 Within if statement Outside if statement
<?php

// Displaylinks based upon thelogin status:

if (isset($_SESSION['user_id'])) {
	
	echo 'Welcome';
	
	if (isset($_SESSION['first_name'])) {
		echo ", {$_SESSION['first_name']}!&nbsp";
		
		}

echo 'content if guest';

// Add links if the user is an member:

if ($_SESSION['user_level'] == 1) {

echo 'content if member';



}

// Add links if the user is an administrator:

if ($_SESSION['user_level'] == 2) {

echo 'content if admin';



}

} else

 { // Not loggin in.



echo '<table width="100%" border="0" cellspacing="0" cellpadding="8">
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Members</strong> <br />
                                                          <span class="infoboxblue">£<?php echo $row_Recordset1[memberfee]; ?></span><br />
                                                      </p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong class="toptextgap">Guests</strong> <br />
                                                          <span class="infoboxblue">£<?php echo $row_Recordset1[guestfee]; ?></span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Young Members</strong> (Age 25 and under) <br />
                                                          <span class="infoboxblue">£<?php echo $row_Recordset1[youngmemberfee]; ?></span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Young Guests</strong> (Age 25 and under) <br />
                                                          <span class="infoboxblue">£<?php echo $row_Recordset1[youngfee]; ?></span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><a href="joinanjoman.php"><img src="img/button-click.gif" width="205" height="37" border="0" /></a></td>
                                                    </tr>
                                                    </table>';

}

?>

Open in new window

BrighteyesDesignAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EMB01Commented:
Could you please send the part of the code where $row_Recordset1 variable is defined.  It seems likely that the variable is never looped properly.
0
mars-vieCommented:
You have a starting tag
<?php echo $row_Recordset1[memberfee]; ?>
on line 45

It should be
<span class="infoboxblue">£ '.$row_Recordset1[memberfee].'</span><br />

because you are already echoing form line 42 on

M@RS
0
EMB01Commented:
>> You have a starting tag

Yes!  That sounds right, actually.  Go with that.
0
pelbooksCommented:
Hello

Your problem is with the echo. You have "echo'ed" the php tag instead of executing it. You can't do that. Please replace with this:

(Note: the dot concatenates/merges strings)

echo '<table width="100%" border="0" cellspacing="0" cellpadding="8">
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Members</strong> <br />
                                                          <span class="infoboxblue">'.$row_Recordset1[memberfee].'</span><br />
                                                      </p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong class="toptextgap">Guests</strong> <br />
                                                          <span class="infoboxblue">£'.$row_Recordset1[guestfee].'</span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Young Members</strong> (Age 25 and under) <br />
                                                          <span class="infoboxblue">£'.$row_Recordset1[youngmemberfee].'</span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><p><strong>Young Guests</strong> (Age 25 and under) <br />
                                                          <span class="infoboxblue">£'.$row_Recordset1[youngfee].'</span></p></td>
                                                    </tr>
                                                    <tr>
                                                      <td bgcolor="#FFFFFF"><a href="joinanjoman.php"><img src="img/button-click.gif" width="205" height="37" border="0" /></a></td>
                                                    </tr>
                                                    </table>';
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrighteyesDesignAuthor Commented:
Works great now, thanks a million!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.