如何获取从数据库调用的可点击图像的变量?

时间:2016-10-03 11:08:39

标签: java php html mysql

  Description  i am calling images from database , i want to click on  particular image to get detailed of that image which i had stored in table .

在一个表格行中,我打印所有图像并给出onclick" alert("")在这里我得到了我点击了哪个图像的ID。所以如何传递我的变量获取图像时单击其他页面(以便我可以从该ID调用所有详细信息)。

 <html><body>
 echo"<table>";
 echo "<tr>";



 echo "<th>"; echo "<h1>";echo"Id";echo "</h1>";echo "</th>";



 echo "<th>"; echo "<h1>";echo"Logo of Websites";echo "</h1>";echo "</th>";

 echo "<th>"; echo "<h1>";echo"WebSite Name";echo "</h1>";echo "</th>";

 echo "<th>"; echo "<h1>";echo"WebSite Link";echo "</h1>";echo "</th>";

 echo "<th>"; echo "<h1>";echo"WebSite Rating";echo "</h1>";echo "</th>";



 echo "<th>"; echo "<h1>";echo"Rate Here";echo "</h1>";echo "</th>";



 echo"</tr>";

 while($row = mysqli_fetch_assoc($find_data)){

 echo"<tr>";

 echo"<td>"; echo $row["id"]; echo"</td>";
 ?><div name = "ashish"><?php
 $idd=$row["id"];?></div><?php
 $showLink=$row["game"];


 echo"<td>";?> <img src="images\logo\<?php echo $row["votted"];?>"     height="100px" weidth="60px" data-toggle="modal" data-target="#myModal"    onClick="alert(<?php echo $row['id']; ?>)"> <?php echo"</td>";

 echo"<td>"; echo $row["picture"]; echo"</td>";

 echo"<td>";?><a href="https://<?php echo $row["game"]?>"> <?php echo       $row["game"]; ?></a><?php  echo"</td>";

 echo"<td>"; echo "Total Rating -> ";echo $row["rating"]; echo "</br>";echo      "Total number of People Voted -> ";echo$row["hits"];
 echo"</td>";
 echo"<td>"; ?><form action='index.php?option=com_content&view=article&id=47'    method ='POST' enctype='multipart/form-data' ><input type='submit' value='Rate   Here !' name='rateus'/></form><?php echo"</td>";

echo "</tr>";

}
echo"</table>";
</body>

</html> 
  Description  i am calling

来自数据库的图片,  我想点击  要获得详细的特定图像 那个图像 我把它存放在桌子里。

1 个答案:

答案 0 :(得分:0)

尝试使用简单的锚点动作,改变

 echo"<td>"; echo $row["picture"]; echo"</td>";

  echo "<td><a href='viewpage.php?id=".$row['id']."'</a>", $row["picture"], "</td>";

并在 viewpage.php

$imageId = $_GET['id'];
// Here select the details of image using $imageId and display it here.