+2 votes
26 views

I want that only my website’s content change and the header and footer to be in a fixed position. I read very much about it, but I can’t find a solution. I’ve made an include() for the header and footer, and the site’s content comes into a

But I can’t handle the PHP codes inside the div. I have a login system and when I include the PHP file, before and after login contents can be seen at the same time. What’s wrong with my code?

index.php

var prev_id = 'h10';
var now_id = '';
function change(menuID)
{ // Mozilla and Friends
  now_id = menuID;
        if (window.XMLHttpRequest)
        {
                req = new XMLHttpRequest();
        }
        else
          if (window.ActiveXObject)
          { // Internet Explorer
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                }
        req.onreadystatechange = processChoices;
        req.open("GET", "change.php?menuID="+menuID+"", false);
        req.send(null);
}
function processChoices()
{ // wait until the request is done
        if (req.readyState == 4)
        { // Make sure request came back OK
                if (req.status == 200)
                {
      document.getElementById('content').innerHTML = req.responseText;
      prev_id = now_id;
    }
        else
                { alert("Nem lehet betölteni" + req.statusText); }
        }
}
<?php include("footer.php"); ?>

change.php

<?php
header("Content-Type: text/plan; charset=utf-8");
$page = '';
$pg = isset($_GET['menuID']) ? $_GET['menuID'] : 'h10';
switc  case "h10":
    $page = 'about.php';
    break;
  case "h11":
    $page = 'contact.php';
    break;
  default:
    $page = about.php';
}
if($pg) {
echo file_get_contents($page);
?>
by (1.7k points)   | 26 views

Please log in or register to answer this question.

Related questions

+3 votes
0 answers
asked Jun 17 by noor (1.1k points) | 6 views
+2 votes
0 answers
+3 votes
1 answer
asked Mar 30 by toheed (1.2k points) | 21 views
+1 vote
1 answer
+4 votes
1 answer
asked Mar 29 by admin (1.3k points) | 31 views
+3 votes
0 answers




Welcome to Meansflow - Where Developers and Students Learn, Share, & Build Careers, where you can ask questions and receive answers from other members of the community.
108 questions
79 answers
37 comments
99 users