Why is this facebook app refreshing endlessly
<p>I kindly request that you help me identify the reason in the code why my app keeps refreshing endlessly. This does not allow me to navigate to other pages, Iam a learner in php and I suspect this could be the issue, help. Could it be a problem with the php arrangement? </p>

<p>Here is the code in index.php</p>

<pre><code>            &lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $('#premium_b').click(function(e) {
        e.preventDefault();
        $('#tabs').tabs( "select" , 4 );
    });
    $('#tabs').bind('tabsselect', function(event, ui) {
        if (ui.index == 4 )
            $('#premium_b').css ('display', 'none');
        else
            $('#premium_b').css ('display', 'block');
    }); 
});
&lt;/script&gt;
&lt;div id="bloc_134" class="li_bloc"&gt;&lt;ul class="menu"&gt;&lt;li&gt;&lt;a href="http://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_homepage&amp;amp;tab=contact_form_homepage&amp;amp;page_id=" title="contact_form_homepage" class="fbtab"&gt;Home&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_config&amp;amp;tab=contact_form_config&amp;amp;page_id=" title="contact_form_config" class="fbtab"&gt;Config&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_export&amp;amp;tab=customize_css&amp;amp;page_id=" title="contact_form_css" class="fbtab"&gt;Customize&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_export&amp;amp;tab=contact_form_export&amp;amp;page_id=" title="contact_form_export" class="fbtab"&gt;Export&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_premium&amp;amp;tab=premium&amp;amp;page_id=" title="contact_form_premium" class="fbtab"&gt;Premium&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_stats&amp;amp;tab=contact_form_stats&amp;amp;page_id=" title="contact_form_stats" class="fbtab"&gt;Statistics&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_doc&amp;amp;tab=doc&amp;amp;page_id=" title="contact_form_doc" class="fbtab"&gt;Doc&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_about&amp;amp;tab=contact_form_about&amp;amp;page_id=" title="contact_form_about" class="fbtab"&gt;About&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_other_app&amp;amp;tab=contact_form_other_app&amp;amp;page_id=" title="contact_form_other_app" class="fbtab"&gt;Other Apps&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_faq&amp;amp;tab=contact_form_faq&amp;amp;page_id=" title="contact_form_faq" class="fbtab"&gt;FAQ&lt;/a&gt;
            &lt;/li&gt;
            &lt;/ul&gt;
            &lt;a href="https://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_premium&amp;amp;tab=premium&amp;amp;page_id=" title="Upgrade to Premium to get white branding and help us improve your favourite apps! : Click her" id="premium_b"&gt;Upgrade to Premium to get white branding and help us improve your favourite apps! : Click her&lt;/a&gt;
            &lt;div class="clear"&gt;&lt;/div&gt;
            &lt;/div&gt;
                &lt;/div&gt;
    &lt;div id="alerts"&gt;
            &lt;/div&gt;
    &lt;div id="zone2" class="li_zone li_x1 li_y2"&gt;

&lt;div id="contact_form_about"&gt;&lt;div class="zone2"&gt; 
            &lt;/div&gt;&lt;/div&gt;


&lt;div id="contact_form_config"&gt;&lt;div class="zone2"&gt;&lt;script type="text/javascript"&gt;
function refreshApp (url) {
    $.get(url, function(data) {
      $('*').html(data);
    });
}
$(document).ready(function() {
var options = { 
success: showResponse,
beforeSubmit: disableButton
}; 
$('#tab_info_form_0').ajaxForm(options);
});

function addToPage() {
var obj = {
  method: 'pagetab',
  redirect_uri: 'https://apps.facebook.com/mtkenya-dev/?page_id=#contact_form_config',
};

FB.ui(obj);
}
&lt;/script&gt;
&lt;script&gt;top.location.href='https://www.facebook.com/dialog/oauth?client_id=461688580525581&amp;redirect_uri=https%3A%2F%2Fapps.facebook.com%2Fmtkenya-dev%2F%3Ftab%3Dcontact_form_config&amp;scope=email,manage_pages'&lt;/script&gt;&lt;/div&gt;
            &lt;div class="zone2"&gt;&lt;script type="text/javascript"&gt;
$(document).ready(function() {
var options = { 
success: showResponse,
beforeSubmit: disableButton
}; 
$('#contact_form').ajaxForm(options);
$('#customize_css').ajaxForm(options);
});
&lt;/script&gt;
&lt;div id="bloc_133" class="li_bloc"&gt;&lt;p&gt;Page non trouv?e&lt;/p&gt;
            &lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;


&lt;div id="contact_form_css"&gt;&lt;div class="zone2"&gt;&lt;script type="text/javascript"&gt;
function refreshApp (url) {
    $.get(url, function(data) {
      $('*').html(data);
    });
}
$(document).ready(function() {
var options = { 
success: showResponse,
beforeSubmit: disableButton
}; 
$('#tab_info_form_0').ajaxForm(options);
});

function addToPage() {
var obj = {
  method: 'pagetab',
  redirect_uri: 'https://apps.facebook.com/mtkenya-dev/?page_id=#contact_form_css',
};

FB.ui(obj);
}
&lt;/script&gt;
&lt;script&gt;top.location.href='https://www.facebook.com/dialog/oauth?client_id=461688580525581&amp;redirect_uri=https%3A%2F%2Fapps.facebook.com%2Fmtkenya-dev%2F%3Ftab%3Dcontact_form_css&amp;scope=email,manage_pages'&lt;/script&gt;&lt;/div&gt;

            &lt;/div&gt;

            &lt;div id="contact_form_doc"&gt;&lt;div class="zone2"&gt;&lt;script type="text/javascript"&gt;
$(function() {
    $("#bloc_223").tabs({
        ajaxOptions: {
            error: function( xhr, status, index, anchor ) {
                $( anchor.hash ).html(  "Couldn't load this tab. We'll try to fix this as soon as possible. ");
            }
        },
        cache: true
    });
});

&lt;/script&gt;

            &lt;/div&gt;
            &lt;/div&gt;


&lt;div id="contact_form_export"&gt;&lt;div class="zone2"&gt;&lt;script type="text/javascript"&gt;
function refreshApp (url) {
    $.get(url, function(data) {
      $('*').html(data);
    });
}
$(document).ready(function() {
var options = { 
success: showResponse,
beforeSubmit: disableButton
}; 
$('#tab_info_form_0').ajaxForm(options);
});

function addToPage() {
var obj = {
  method: 'pagetab',
  redirect_uri: 'https://apps.facebook.com/mtkenya-dev/?page_id=#contact_form_export',
};

FB.ui(obj);
}
&lt;/script&gt;
&lt;script&gt;top.location.href='https://www.facebook.com/dialog/oauth?client_id=461688580525581&amp;redirect_uri=https%3A%2F%2Fapps.facebook.com%2Fmtkenya-dev%2F%3Ftab%3Dcontact_form_export&amp;scope=email,manage_pages'&lt;/script&gt;&lt;/div&gt;


    &lt;div id="footer" class="li_zone li_x1 li_y4"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;

    &lt;/body&gt;


&lt;/html&gt;
</code></pre>
