In this below code i want to display data in modal window .My aim is to display the searched data in modal dialog .Actual result is they are displaying above the form not in modal dialog.I have tried some steps but i cant able to produce the expected result pls help me.
<?php
$search = (isset($_POST['search']) ? $_POST['search'] : null);
mysql_connect("localhost", "root", "") OR die (mysql_error());
mysql_select_db ("slseatapp") or die(mysql_error());
$query = "SELECT * FROM coursemaster WHERE course_code LIKE '%$search%' or course_name like '%$search%'";
$result = mysql_query($query) or die (mysql_error());
$msg ;
if($result)
{
while($row=mysql_fetch_row($result))
{
$msg=$msg ."ID=".$row[0].",COURSE CODE=".$row[1].",COURSE NAME=".$row[2];
}
echo"<div id='overlay'>('$msg ');</div>";
}
else
{
echo "No result";
}
?>
<script>function overlay(){
el = document.getElementById('overlay');
el.style.visibility = (el.style.visibility == 'visible') ? 'hidden' : 'visible';
}function close() {
document.getElementById('overlay').style.visibility = 'hidden';
}</script>
<style>#overlay div {
width:300px;
margin: 100px auto;
background-color: #fff;
border:1px solid #000;
padding:15px;
text-align:center;
}</style>"
<form action="look.php" method="post">
<center> SEARCH:<input type="text" name="search" placeholder="SEARCH"><br></center>
<center> <input type="submit" name="hhhh" class="btn-success btn"></center>
</form>