在下面的代码中,我想在模态窗口中显示数据。我的目标是在模态对话框中显示搜索到的数据。实际结果是它们显示在表单上方。我尝试了一些步骤,但我无法产生预期的结果请帮我。
<?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"<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>";
echo"<style>#overlay div {
width:300px;
margin: 100px auto;
background-color: #fff;
border:1px solid #000;
padding:15px;
text-align:center;
}</style>";
echo"<div id='overlay'>('$msg ');</div>";
}
else
{
echo "No result";
}
?>
<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>