PHP in Startup Script

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
iggabz
User
Posts: 111

PHP in Startup Script

Post by iggabz »

Good day,

i have this custom php function in Client scripts>table specific>add/copy page>startup script

function hideGuellian() {
    $('section div#r_doc_id').hide();
    $('section div#r__action').hide();
    $('section div#r_date_time').hide();
    $('section div#r_office').hide();
    $('section div#r_received_by').hide();
    $('section div#r_prev_datetime').hide();
    $('section div#r_duration_sec').hide();
    $('section div#r_duration').hide();
    $('section div#r_region').hide();
    $('section div#r_province').hide();
    $('section div#r_city').hide();
    $('section div#r_name').hide();
    $('section div#r__email').hide();
    $('section div#r_tracking_no').hide();
    $('section div#r_date_req').hide();

    if (mavg === 'fr') {
        $('section div#r_province').show();
        $('section div#r_name').show();

        if ($_SESSION['CurrentUserLevel'] == 4) {
            $('section div#r_date_req').show();
        }
    } else if (mavg === 'rr') {
        $('section div#r_province').show();
        $('section div#r_name').show();
    }
}

line 22 is not working. is my syntax correct?


arbei
User
Posts: 9787

Post by arbei »

You cannot mix PHP code ($_SESSION['CurrentUserLevel']) into JavaScript directly, you need to echo it out by PHP.


iggabz
User
Posts: 111

Post by iggabz »

var currentUserLevel = <?php echo $_SESSION['CurrentUserLevel']; ?>;

got this. thank you. i used the line to get the session value


Post Reply