Jump to content

Recommended Posts

I have this code:

 

<?php
					if ($position == 2 || 3) {
					echo 'There are <b>' . $numApps . '</b> applications.';
					echo '<br />';
					echo 'There are <b>' . $numLoa . '</b> Leave of Absense requests.';
					echo '<br />';
					echo 'There are <b>' . $numHub . '</b> hub change requests.';
					echo '';
					} else {}
					?>
					<?php
					if ($position == 1 || 4) {
					echo 'There are <b>' . $numORD . '</b> PIREPs.';
					}
					if ($position == 5) {
					echo 'There are <b>' . $numDFW . '</b> PIREPs.';
					}
					if ($position == 6) {
					echo 'There are <b>' . $numJFK . '</b> PIREPs.';
					}
					if ($position == 7) {
					echo 'There are <b>' . $numLAX . '</b> PIREPs.';
					}
					if ($position ==  {
					echo 'There are <b>' . $numMIA . '</b> PIREPs.';
					}
					?>

 

I only want each of these to show if $position (a session) equals the numbers that I have on there, but it shows the first if statement to anyone.

Link to comment
https://forums.phpfreaks.com/topic/243945-limiting-what-people-view/
Share on other sites

or you could do something like this:

 

<?php
$outputMessage = array(
'1' => 'There are <b>' . $numORD . '</b> PIREPs.';
'2' => 'There are <b>' . $numApps . '</b> applications.<br />There are <b>' . $numLoa . '</b> Leave of Absense requests.<br />There are <b>' . $numHub . '</b> hub change requests.';
'2' => 'There are <b>' . $numApps . '</b> applications.<br />There are <b>' . $numLoa . '</b> Leave of Absense requests.<br />There are <b>' . $numHub . '</b> hub change requests.';
'4' => 'There are <b>' . $numORD . '</b> PIREPs.';
'5' => 'There are <b>' . $numDFW . '</b> PIREPs.';
'6' => 'There are <b>' . $numJFK . '</b> PIREPs.';
'7' => 'There are <b>' . $numLAX . '</b> PIREPs.';
'8' => 'There are <b>' . $numMIA . '</b> PIREPs.';
);
echo $outputMessage[$position];
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.