title: want to make view json file data using php
body: <p>i make a crud system with json file data. i used javascript to view data into a html file. but i think it cause some security issues. i want to make my data view using php not in JavaScript. </p>
  
  <p>this is my JavaScript view file</p>
  
  <pre><code>var output = document.getElementById('output');
  
  var ajaxhttp = new XMLHttpRequest();
  
  var url = "form.json";
  
  var xhttp = new XMLHttpRequest();
  var details = '';
  xhttp.onreadystatechange = function() {
      if (this.readyState == 4 &amp;&amp; this.status == 200) {
  
          var response = JSON.parse(xhttp.responseText);
  
                  var output = '';
  
                  output += "&lt;table class='table table-bordered'&gt;";
                  output += "&lt;tr&gt;&lt;th scope='col'&gt;id&lt;/th&gt;&lt;th&gt;First Name&lt;/th&gt;&lt;th&gt;Last Name&lt;/th&gt;&lt;th&gt;Age&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;";              
  
                  for(x in response){
  
                      if(response[x].is_active == "1"){
  
  
                      output += "&lt;tr&gt;&lt;td&gt;" + response[x].id + "&lt;/td&gt;&lt;td&gt;" + response[x].firstname + "&lt;/td&gt;&lt;td&gt;"+response[x].lastname+"&lt;/td&gt;&lt;td&gt;"+response[x].age+"&lt;/td&gt;&lt;td&gt;&lt;a href='edit.php?id="+response[x].id+"&amp;firstname="+response[x].firstname+"&amp;lastname="+response[x].lastname+"&amp;age="+response[x].age+"' class='btn btn-primary btn-sm active' role='button' aria-pressed='true'&gt;Edit&lt;/a&gt;&lt;a href='update.php?id="+response[x].id+"&amp;firstname="+response[x].firstname+"&amp;lastname="+response[x].lastname+"&amp;age="+response[x].age+"' class='btn btn-danger btn-sm' role='button' data-toggle='modal' data-target='#exampleModal' name='btnDelete' style='margin-left: 10px;'&gt;Delete&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
  
                      }
  
                  }
  
                  output += "&lt;/table&gt; ";
                 document.getElementById("output").innerHTML = output;
  
      }
  };
  xhttp.open("GET", url, true);
  xhttp.send();
  </code></pre>
  
  <p>i want to do this same thing using php. can anyone help me?</p>