-2

I've got a webpage that works with includes (I didin't build it but I'm working on it now), the thing is that the admin page in which I had to make an addition had by default an include into a certain gif which im gonna insert in a picture, that's the whole div that matters , I want to know if there is a way to include the new content I made and include it into that same div so I don't need to reload the whole page.

the piece of code cantaining the default include which isn't commented and the one i wanna add is the one commented

  <div id="content-wrapper">
<div class="row" style="opacity: 1;">
<div  class="col-lg-12">

       <div  id="container" class="container" width="100wv" height="100wv">

<?php 
      include 'solicitudlst.phi';
       //include 'pruebaPHP.php';


?>
<script>



</script>

<div class="row">
<div class="col-lg-12">
&nbsp;
</div>
</div>


<?php 
      include 'footer.phi';
?>

      </div>

         </div>
         </div>
         </div>

the commented include is the new one I want to add, and the other one is the one that was by default.

The blue circle shows the href which is selected by default and contains the content that shows on the right, and the red circle shows the href I wanna click and and change the content on the right by dynamically include the new php

  • Please post your code here so it is preserved for future SO visitors. – Jay Blanchard Apr 18 '16 at 20:17
  • To do what you're asking look into AJAX. – Jay Blanchard Apr 18 '16 at 20:25
  • as Jay says, ajax is what you need. this [page](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) has a lot of useful info – andrew Apr 18 '16 at 20:50
  • Also: smack whoever thought they were being cute by changing the extension. If they say 'for security' smack them again. – David J Eddy Apr 18 '16 at 20:57
  • ikr, i mean i dind't build the page but ihave to work with it... and the thing is that i am looking for a way to dynamically change the includes by clicking on dif hrefs , so the includes happens in the same div as they already are but you know after clicking – Marcela Flores Apr 18 '16 at 21:02

1 Answers1

0
<?php 
      include ("yourfile.php");
?>

That should work. I'm not really sure what a .phi file is though.

Chris Stanley
  • 2,766
  • 2
  • 13
  • 18
  • yeah i am already using the include, the thing is that i need that include to be dynamic which means the content part changes after clicking a href, so the "blank " part of the page is filled with a different include – Marcela Flores Apr 18 '16 at 21:03
  • Then use a variable for the include file name. – Chris Stanley Apr 18 '16 at 21:06
  • I have managed to do what I wanted at first but...the ajax i used is only printing the code for the table but not filling anything with actual info, idk what could be wrong there because if I include the other php directly without any functions or ajax into the div i want it shows everything properly but if i use the ajax it just prints the the strcuture butnot content at all – Marcela Flores Apr 19 '16 at 16:41