我需要帮助将行从mysql数据库传递到div弹出窗口?
我如何将product id
传递给我通过<a href="#shirt" class="view_btn">View</a>
调用的弹出式div?
例如我想要这样
<a href="#shirt?id=<?php $row['id']" class="view_btn">View</a></li>
这里是我的代码
<div class="latest_products_sec">
<div class="latest_products">
<div class="title_box">
</div>
<!--Latest Products Slider -->
<div class="latest_pro_box">
<h4><a href="detail.html">Latest Shirt's Collection</a></h4>
<div class="latest_products_slider">
<?php
$queryshirt=mysql_query("select image,id from products
where cid='1' LIMIT 5") or die ('die shirt query');
while($rowshirt=mysql_fetch_array($queryshirt))
{
echo '<ul>';
echo '<li><img src="admin/'.$rowshirt['image'].'"
width="225" height="300" alt="" />
<a href="#shirt" class="view_btn">View</a></li>';
echo '</ul>';?>
}
?>
#shirt Div弹出窗口
<div id="shirt" class="proquickview">
<span class="close_btn" onclick="parent.jQuery.fancybox.close();">Close</span>
<h2 class="title">quick view</h2>
<div class="quickviewinfo">
<?php
// I Need To Get ID Here
echo $id=$_REQUEST['id'];
?>
<div class="quickviewinforight">
<div class="titlerow">
<h2>Latest Shirt's Collection</h2>
<div class="start_ratings">
<div class="start_rating">
</div>
</div>
<div>
<div class="quick_review">
<h3>Quick Discription</h3>
<p>TEST.</p>
</div>
<div class="qty_row">
<div class="qty_field">
<label>Select Quantity</label>
<span>
<select name="S">
<option>5</option>
</select>
</span>
</div>
<br class="clear" />
<span class="total_price">Price <strong>$88.00</strong>
<del>$102.00</del></span>
<a href="cart.html" class="add_cart_btn">ADD TO CART</a>
</div>
<div class="total_price_row">
</div>
</div>
</div>
</div>
用于弹出窗口的Javascript
$(document).ready(function() {
$(".view_btn").fancybox({
'titlePosition' : 'inside',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
});
$(document).ready(function(){
// Cufon Functions //
Cufon.replace ('.latest_products_slider ul li a.view_btn',{hover:true});
});
答案 0 :(得分:0)
您可以使用新的'echo'
echo '<a href="#shirt?id='.$row['id'].'" class="view_btn">View</a></li>';
而不是使用此
echo '<li><img src="admin/'.$rowshirt['image'].'" width="225" height="300" alt="" />
<a href="#shirt" class="view_btn">View</a></li>';
组合'echo'语句用于图像和链接到View
答案 1 :(得分:0)
使用jQuery .load函数。然后在动作上创建一个隐藏的div,tgen,使用load函数加载隐藏的div并将css选择更改为可见。非常简单,也可以添加效果。