drjk87189 2015-03-11 16:53
浏览 32

显示产品详细信息单击按钮返回false时

I'm comming up with a problem when i want to display a div Pop-up that appears when users click a button returning false. This mean I can't find ways to display a product detail in div pop-up without loading a page again.

I'm looking for a solution like this and any relevant ways. Here is my code:

Explain:

  • $product_list is used for displaying products and $product_list2 is used for display div Popup.

  • Button With Onclick Add_to_cart() will return false and change div_top1 from display: none to display: block.

    <?php
    include 'Config.php';
    $product_list = "";
    $product_list2 = array(0 => "");
    $sql = mysql_query ('SELECT * FROM sanpham ORDER BY id DESC');
    $product_count = mysql_num_rows ($sql);
    
    $a=0;
    if ($product_count >0) {
    while ($row = mysql_fetch_array ($sql)){
    $ID = $row["ID"];
    $ID2 = $row["ID2"];
    $a++;
    $product_name = $row["productname"];
    $price = $row["Price"];
    $product_list .= '<td class="table_cell_sellingsection"><img src="Productimages/'.$ID.'.png" class="imagesproduct" alt="">
    <p>'.$product_name.'&nbsp;</p> <hr> <p class="price_product">Price: '.$price.' vnđ</p> <p> 
    <form name="Addtocart" method="post" action="" >
    <input type="hidden" name="pid" value="'.$ID.'">
    <button class="Button-Addtocart" type="submit" onclick="Add_to_Cart()"> <img class="Add_to_cart" src="images/Addtocart.png" width="65" height="26" alt="">   </button> 
    </form>
    
    <button id ="button-click" type="submit" class="Button-detail" onclick="changediv()">
    <img class="Button-detail-img" src="images/Detail.gif" width="70" height="26" alt=""></p></td>';
    
    array_push($product_list2, '<div id="div_top1">
    <div class="div-detail">
    <table width="100%" height="100%" border="0" cellspacing="3" cellpadding="4">
    <tr>
    <td class="headname" height="55" colspan="3">'.$product_name.'</td>
    
    </tr>
    <tr>
    <td width="35%" height="273" rowspan="1"><img class="imagesproduct1" src="Barefoot_2014_DVD_Cover.jpg" width="1024"             height="687" alt=""></td>
    <td class="info-more" width="65%">
      PRICE: VNĐ <hr>
      DESCRIPTION <hr>
    <span class="des-info">Chất liệu: Cotton<br>
    
      Thoáng mát phù hợp với mọi lứa tuổi
      Đảm bảo chất lượng cao, số lượng có hạn, click để mua!</span>
    </td>
    </tr>
    <tr>
    <td class="size-product" width="35%" height="57">
    <span style="padding-right: 30px;">SIZE</span>  X XL XXL
    
    </td>
    <td><form name="Addtocart" method="post" action="" >
    <input type="hidden" name="pid2" value="'.$ID2.'">
     <input type="hidden" name="pid" value="'.$ID.'">
     <button class="Button-Addtocart" type="submit" onclick="Add_to_Cart()"> <img class="Add_to_cart" src="images/Addtocart.png" width="65" height="26" alt=""></button> 
     </form>
    <button id ="button-click" type="submit" class="Button-detail" onclick="changediv()"><img class="Button-detail-img" src="images/Detail.gif" width="70" height="26" alt=""> </td></tr></table></div></div>');}   } else {echo "You have no product";}
    
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用