divポップアップの後に値をエコーしたり取得したりすることに問題があります.divpopupの後に$rが表示されないという問題を誰でも助けることができます. むしろ、フェッチが繰り返されず、最初のレコードのみが表示されます..よろしくお願いします
<?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>