Jump to content

Limiting what people view


dudejma

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];
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.