www.webdeveloper.com
Results 1 to 4 of 4

Thread: ternary operator

Hybrid View

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

    ternary operator

    I'm getting errors in my code on the first couple lines because of the echo... I'm confused on how to set the ternary operator in a string like this...


    PHP Code:
    <?php if(login::$company =='ARSE') echo <form action='<?php echo matry::here(); ?>' method='post'>
    <
    table><th>RX TRACKER</th>
    <
    tr style="z-index: 5;"><td><?php echo lookup_link('* Doctor''doctor''DFCODE=Code&DFNAME=Name'); ?></td><td><?php inp('dfcode'13); ?></td><td>Signed On</td><td><?php inp('signed_on'13); ?></td>
    <td>Diagnosis Code</td><td><?php sbox('diagnosis'sql::one_column_array("SELECT id FROM " event_table('dxcode') . "")); ?></td>
    <tr><td style="position: relative; top: 11px;">Duration</td><td style="position: relative; top: 11px;"><?php sbox('duration'range(1,12), 5); ?></td><td style="position: relative; right: 50px; top: 11px;">Insulin</td><td style="position: relative; right: 80px; top: 11px;"><?php cbox('Insulin'); ?></td>
    <td style="position: relative; right: 160px; top: 11px;">Times Testing</td><td style="position: relative; right: 160px; top: 11px;"><?php sbox('times_testing'range (120)); ?></td></tr>
        
        <tr><td style="position: relative; bottom: 16px; left: 520px;"><?php echo button::save_narrow('Update'); ?></td></tr>

    else

    <?php if(login::$company =='ABSS') include('tracker.php'); ?></table>

    </table>


    </form>

  2. #2
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    If the first login is correct they should see the table data... else show them the data inside the include at the bottom.

    Any help would be greatly appreciated. Thanks

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,936
    Well, I don't see any ternary operators in there right now, but I do see a problem with the quoting (or lack thereof) of the literal text to be output by that first echo. Assuming you only want to apply the first if statement to the <form> tag, I might do something like:
    PHP Code:
    <?php if(login::$company =='ARSE') { ?>
    <form action='<?php echo matry::here(); ?>' method='post'>
    <?php ?>
    "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

  4. #4
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    what about adding a sql clause to this if statement:

    PHP Code:
    <?php if(login::$company =='ACSS') include('task/ACS/include/rx_tracker.php');?></table>
    I need it to be where category_id = '03'

    How would i insert that into this string above.. i'm having a bit of trouble.

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