我在 div 弹出窗口后回显甚至检索值时遇到问题,任何人都可以帮助解决问题是 $r 在 div 弹出窗口之后没有显示。或者更确切地说,提取不会迭代并且它只显示第一条记录..提前谢谢
<?php
$con = mysql_connect('****', 'root','****') or die('Error connecting to MySQL server.');
mysql_select_db("dreschema", $con) or die("cannot select DB");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link href="styles2.css" rel="stylesheet" type="text/css" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<link href="styleshref.css" rel="stylesheet" type="text/css" />
<script>
</script>
</head>
<body>
<div id="container1">
<div align="center"></div>
<div id="mainContent1">
<?php
$text = $_GET["searchtext"];
echo "Results displayed for ". $text;
echo '</br>';
$query4 = "SELECT * from products WHERE ProductName LIKE '%$text%'";
$data = mysql_query($query4, $con);
if (!mysql_query($query4, $con)){
print mysql_error();
exit;
}
while ($row = mysql_fetch_array($data)) {
echo $row['ProductName'];
if($row['Stock']== 0 OR $row['Stock']== "")
{
echo "(SOLDOUT)";
echo '<input type="hidden" name="prod" value="' . $row['Image'] . ' " " id = "prod">';
echo '<a href="preorder.php?image=' . $row['Image'] . '"><img id = "imageid" src="' . $row['Image'] . '" alt="' . $row['Image'] . '" width="80" height="80" style="margin-left:1.5em;margin-top:1.5em;"/></a>';
echo $row['Price'] . "PhP";
?>
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<a href="#" onclick="popup('popUpDiv')"><font size =" 20">x</font></a><br>
<a href="#" onclick="popup('popUpDiv')" ><?php echo '<iframe src="orders2.php?image=' . $row['Image'] . '"style= position:absolute;width:500px;height:500px;"></iframe>';?> </a>
</div>
<a href="#" onclick="popup('popUpDiv')">Click to Open CSS Pop Up</a><br>
<?php
}
else
{
echo '<input type="hidden" name="prod" value="' . $row['Image'] . ' " " id = "prod">';
echo '<a href="orders2.php?image=' . $row['Image'] . '">';
echo '<img id = "imageid" src="' . $row['Image'] . '" alt="' . $row['Image'] . '" width="80" height="80" style="margin-left:1.5em;margin-top:1.5em;"/></a>';
echo $row['Price'] . "PhP";
$r = $row['Image'];
echo '<br>';
?>
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<?php
echo $r;
?>
<a href="#" onclick="popup('popUpDiv')"><font size =" 20">x</font></a><br>
<a href="#" onclick="popup('popUpDiv')" ><?php echo '<iframe src="orders2.php?image=' . $row['Image'] . '"style= position:absolute;width:500px;height:500px;"></iframe>';?> </a>
</div>
<a href="#" onclick="popup('popUpDiv')">Click to Open CSS Pop Up</a><br>
<?php
}
}
?>
<!-- end #mainContent --></div>
<!-- end #container --></div>
</body>
</html>