www.webdeveloper.com
Results 1 to 2 of 2

Thread: if else statement help

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Lightbulb if else statement help

    How would i go about doing something like this, I want to show the include file if it's a certain login else show all the html if it's another login???

    PHP Code:
    <?php if (login::$arre_company == 'APS') { include('task/APS/include/rx_tracker.php'); }?>

    <div style="border:2px solid #a1a1a1; height: 264px; background:#dde;  -moz-border-radius: 10px;
     -webkit-border-radius: 10px; border-radius: 10px; /* future proofing */
     -khtml-border-radius: 10px; /* for old Konqueror browsers */ .one-edge-shadow 
        -webkit-box-shadow: 0 8px 6px -6px black;
           -moz-box-shadow: 0 8px 6px -6px black;
                box-shadow: 0 8px 6px -6px black;">
                
    <form action='<?php echo matry::here(); ?>' method='post'>
    <input type='hidden' name='image_id' value='<?php echo req('uniqueid');?>' />
    <table><th><br>&nbsp;&nbsp;RX TRACKER</th>
    <tr><td>&nbsp;&nbsp;Warfarin Date</td><td><?php inp('warfarin_date'10); ?></td>
    <!--<td>&nbsp;&nbsp;Verified By</td><td><?php inp('signed_on'3); ?></td>
    <td>&nbsp;&nbsp;Verified At</td><td><?php inp('verified_at'10); ?>--><td>&nbsp;&nbsp;Diagnosis Code</td>
    <td><?php sbox('diagnosis'sql::one_column_array("SELECT id FROM " event_table('dxcode') . "")); ?></td></tr>
    <tr><td style="position: relative; left: 2px; top:20px;">&nbsp;&nbsp;INR Low</td><td style="position: relative; left: 0px; top:20px;"><?php sbox('inr_low'sql::one_column_array("SELECT inr_value from event.acs.inr_value")); ?></td>
    <td style="position: relative; left: 2px; top:20px;">&nbsp;&nbsp;INR High</td><td style="position: relative; left: 0px; top:20px;"><?php sbox('inr_high'sql::one_column_array("SELECT inr_value from event.acs.inr_value")); ?></td>
    <td style="position: relative; top:20px;">&nbsp;&nbsp;Active</td><td style="position: relative; top:20px;"><?php cbox('active'); ?></td></tr>
    </tr><tr><td><br><br><br>&nbsp;&nbsp;<?php echo button::save_narrow('Update'); ?></td></tr></table></form></div><br />

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    If all you want to do is include the other file and be done with it, the simplest thing might be:
    PHP Code:
    <?php
    if($somethingIsTrue) {
        include 
    "the/include/file.php";
        exit;
    }
    ?>
    <p>rest of page here</p>
    Otherwise, just use an else block around whatever needs to be done:
    PHP Code:
    <?php
    if($somethingIsTrue) {
        include 
    "the/include/file.php";
    }
    else {
    ?>
    <p>rest of page here</p>
    <?php
    // need to close up the else block
    ?>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles