 <p><strong>Use Ajax for this :</strong></p> <p>Add this code to main page where you want to display table data</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function dashboard() { var query_parameter = document.getElementById("name").value; var dataString = 'parameter=' + query_parameter; // AJAX code to execute query and get back to same page with table content without reloading the page. $.ajax({ type: "POST", url: "execute_query.php", data: dataString, cache: false, success: function(html) { // alert(dataString); document.getElementById("table_content").innerHTML=html; } }); return false; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="table_content"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In <strong>table_content</strong> div the data come from <strong>execute_query.php</strong> page will load without refreshing the page.</p> <p><strong>execute_query.php</strong></p> <pre><code>$user_name = $_POST['parameter']; $query="SELECT * from info where name=$user_name"; $result=mysql_query($query); $rs = mysql_fetch_array($result); do { ?&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $rs['city']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $rs['phone_number']; ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php }while($rs = mysql_fetch_array($result)); </code></pre>