This is portion of my index.html

<script type="text/javascript">
function callPortion()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("main").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","welcome.php",true);
xmlhttp.send();
}
</script>
  </head>
  
  <body> 
  
  <a href=# shape="rect" onclick="callPortion()">Gallery</a>
  
  <div id ="main"></div>

...

this is my welcome.php page

<?php
<div>
<p> Welcome! </p>
</div>
?>

How do I make it so that when you click on the gallery link, that it opens displays the php page in the "main" div tags?

change your php to something like this:

<?php
    $content = "<div>
    <p> Welcome! </p>
    </div>";
	echo $content;
    ?>

tested with your code works as expected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.