Modal in PHP with php include
<p>I'm trying to use modal in PHP with the include function but there is an error with the header.php file I guess.</p>

<p>Here is the code for the modal:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;?php include 'header.php'; ?&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;button id="myBtn"&gt;Open Modal&lt;/button&gt;
&lt;div id="myModal" class="modal"&gt;
  &lt;div class="modal-content"&gt;
    &lt;span class="close"&gt;x&lt;/span&gt;
    &lt;p&gt;Some text in the Modal..&lt;/p&gt;
  &lt;/div&gt;

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

<p>This is what is inside the header.php file:</p>

<pre><code>&lt;!-- Latest compiled and minified CSS --&gt;
&lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;

&lt;!-- jQuery library --&gt;
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"&gt;&lt;/script&gt;

&lt;!-- Latest compiled JavaScript --&gt;
&lt;script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
&lt;link rel="stylesheet" type="text/css" href="/css/style.css" media="screen" /&gt;
&lt;script type="text/javascript" src="file.js"&gt;&lt;/script&gt;
</code></pre>

<p>EDIT:</p>

<p>The error is the css file and js file cant process.
But when I do this, it's working :</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
    /* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content/Box */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
}

/* The Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;button id="myBtn"&gt;Open Modal&lt;/button&gt;
&lt;div id="myModal" class="modal"&gt;
  &lt;div class="modal-content"&gt;
    &lt;span class="close"&gt;x&lt;/span&gt;
    &lt;p&gt;Some text in the Modal..&lt;/p&gt;
  &lt;/div&gt;

&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;script type="text/javascript"&gt;
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the &lt;span&gt; element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal 
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on &lt;span&gt; (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}

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