how to declare this variable outside if else loop
<p>so here is my problem; i am working on some code that has been handed to me by other team-members (not my code); so it is quite in depth &amp; tedious to figure out where all the variables and such match up, i managed to find out this piece that was giving me trouble in why my code here did not work</p>

<pre><code>&lt;td nowrap style="border-left: 1px solid #dddddd;" align="center"&gt;&amp;nbsp;&amp;nbsp;

                     &lt;?=$display_balance_details;?&gt;
</code></pre>

<p>this code apparently sets it so that $display_balance_details is only set on certain pages, my problem is that I am trying to move this to the header of all the webpages;</p>

<pre><code>    else if ($section == 'history')
    {
        $user = new user();
        $user-&gt;setts = &amp;$setts;

        $row_user = $db-&gt;get_sql_row("SELECT * FROM
            " . DB_PREFIX . "users WHERE user_id=" . $session-&gt;value('user_id'));

        $template-&gt;set('user_details', $row_user);

        $template-&gt;set('display_account_status', $user-&gt;account_status($row_user['active'], $row_user['approved']));

        $user_payment_mode = $fees-&gt;user_payment_mode($session-&gt;value('user_id'));
        $template-&gt;set('user_payment_mode', $user_payment_mode);

        $template-&gt;set('display_payment_mode', $user-&gt;payment_mode_desc($user_payment_mode));

        (string) $display_balance_details = null;
        $display_balance_details = $user-&gt;show_balance($row_user['balance'], $setts['currency']);

        if ($user_payment_mode == 2 &amp;&amp; $row_user['balance']&gt;=$setts['min_invoice_value'])
        {
            $display_balance_details .= ' [ &lt;a href="fee_payment.php?do=clear_balance"&gt;' . MSG_CLEAR_ACC_BALANCE . '&lt;/a&gt; ]';
        }

        $template-&gt;set('display_balance_details', $display_balance_details);

        $show_history_table = false;
</code></pre>

<p>and this code tells what pages to set it on </p>

<pre><code>&lt;? } else if ($page == 'account') { ?&gt;
&lt;td nowrap &lt;?=(($section == 'history') ? 'class="subcell_a"' : 'class="subcell_u"');?&gt;&gt;&lt;a href="&lt;?=process_link('members_area', array('page' =&gt; 'account', 'section' =&gt; 'history'));?&gt;"&gt;
</code></pre>

<p>so my problem is how to set $display_balance_details without removing the $section == 'history' bit (because this might cause a bunch of other problems down the road, not sure how the code is written) and how to best approach this issue?</p>
