ISSET中的PHP调用函数检查[重复]

I am trying to call a function from within an ISSET check in PHP.

If I try this below it doesn't work:

function UpdateWIP(){
        $link = mysqli_connect(DB_SERVER,DB_USER,DB_PASSWORD,DB_DATABASE);
        $sql = "update wip_attribute_xref wx left join wip_ship_tran w ON w.wip_id = wx.wip_id  set wx.attribute_value = '" . $_POST['flowtag'] . "' where w.wip_ship_tran_id = " . $id . " and wx.attribute_name = 'FLT_TAG'"; 
        $result = mysqli_query($link, $sql) or die(mysql_error());
}

if(isset($_POST['process']) && isset($_GET['url'])){
    if (strlen($_POST['flowtag'])==10){
        UpdateWip();
        header('Location: wip_ship_csr.php?id=' . urlencode($id) . '&cdid=' . urlencode($cdid) . '&sn=' . urlencode($serialnumber));
    }else{
        echo "MISMATCH";
    }
}elseif(isset($_POST['cancel']) && isset($_GET['url'])){
    header('Location: wip_ship_search.php');
}

But if I do it the below way, it does work. Why? And how can I fix the first way?

if(isset($_POST['process']) && isset($_GET['url'])){
    if (strlen($_POST['flowtag'])==10){
        $link = mysqli_connect(DB_SERVER,DB_USER,DB_PASSWORD,DB_DATABASE);
        $sql = "update wip_attribute_xref wx left join wip_ship_tran w ON w.wip_id = wx.wip_id  set wx.attribute_value = '" . $_POST['flowtag'] . "' where w.wip_ship_tran_id = " . $id . " and wx.attribute_name = 'FLT_TAG'"; 
        $result = mysqli_query($link, $sql) or die(mysql_error());
        header('Location: wip_ship_csr.php?id=' . urlencode($id) . '&cdid=' . urlencode($cdid) . '&sn=' . urlencode($serialnumber));
    }else{
        echo "MISMATCH";
    }
}elseif(isset($_POST['cancel']) && isset($_GET['url'])){
    header('Location: wip_ship_search.php');
}
</div>