获取到有可能是2个或者3个ID,根据ID在输出相应的信息,我用的是smarty模版我现在点击跳转后并没有按照选择到的ID,输出要查询的信息,而是输出了所有ID的信息。到底怎么解决,求大侠帮忙
$hotelid = empty($_COOKIE['hotelid'])?0:$_COOKIE['hotelid'];
$hotel_id= explode(",", $hotelid); {{foreach name=hotel_list from=$hotels item=hotel_compare}}
<td valign="top" class="balanceTBbj">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="name_show">
<tr>
<td><span class="fL blue f12b">01</span><span class="close_btn hand fR margintop-5px"></span></td>
</tr>
<tr>
<td class="f14b">{{$hotel_compare.HotelName}}</td>
</tr>
<tr>
<td align="center"><span class="Star{{$hotel_compare.Star}}"></span></td>
</tr>
<tr>
<td align="center"><a href="detail.php?hotel_id={{$hotel_compare.HotelId}}">
{{if $hotel_compare.Source == 9}}
<img src="{{$hotel_compare.elong_img}}" height="120" align="middle" class=" hotel_photo1 hotel_photoBig" /></a></td>
{{else}}
<img src="{{$_img_server}}/HotelImage.aspx?HotelId={{$hotel_compare.HotelId}}&Title=%E5%A4%96%E8%A7%82&ResponseType=Thumb" class="hotel_photo1 hotel_photoBig" />
{{/if}}
</tr>
<tr>
<td><a href="detail.php?hotel_id={{$hotel_compare.HotelId}}">查看详细>></a></td>
</tr>
</table>
</td>
{{/foreach}}
$hotelid = empty($_COOKIE['hotelid'])?0:$_COOKIE['hotelid'];
$hotel_id= explode(",", $hotelid); {{foreach name=hotel_list from=$hotels item=hotel_compare}}
<td valign="top" class="balanceTBbj">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="name_show">
<tr>
<td><span class="fL blue f12b">01</span><span class="close_btn hand fR margintop-5px"></span></td>
</tr>
<tr>
<td class="f14b">{{$hotel_compare.HotelName}}</td>
</tr>
<tr>
<td align="center"><span class="Star{{$hotel_compare.Star}}"></span></td>
</tr>
<tr>
<td align="center"><a href="detail.php?hotel_id={{$hotel_compare.HotelId}}">
{{if $hotel_compare.Source == 9}}
<img src="{{$hotel_compare.elong_img}}" height="120" align="middle" class=" hotel_photo1 hotel_photoBig" /></a></td>
{{else}}
<img src="{{$_img_server}}/HotelImage.aspx?HotelId={{$hotel_compare.HotelId}}&Title=%E5%A4%96%E8%A7%82&ResponseType=Thumb" class="hotel_photo1 hotel_photoBig" />
{{/if}}
</tr>
<tr>
<td><a href="detail.php?hotel_id={{$hotel_compare.HotelId}}">查看详细>></a></td>
</tr>
</table>
</td>
{{/foreach}}
代码修改如下:
{{foreach name=hotel_list from=$hotels item=hotel_compare}}
<td valign="top" class="balanceTBbj">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="name_show">
<tr>
<td><span class="fL blue f12b">01</span><span class="close_btn hand fR margintop-5px"></span></td>
</tr>
<tr>
<td class="f14b">{{$hotel_compare.HotelName}}</td>
</tr>
<tr>
<td align="center"><span class="Star{{$hotel_compare.Star}}"></span></td>
</tr>
<tr>
<td align="center"><a href="detail.php?hotel_id={{$hotel_compare.HotelId}}">
{{if $hotel_compare.Source == 9}}
<img src="{{$hotel_compare.elong_img}}" height="120" align="middle" class=" hotel_photo1 hotel_photoBig" /></a></td>
{{else}}
<img src="{{$_img_server}}/HotelImage.aspx?HotelId={{$hotel_compare.HotelId}}&Title=%E5%A4%96%E8%A7%82&ResponseType=Thumb" class="hotel_photo1 hotel_photoBig" />
{{/if}}
</tr>
<tr>
<td><a href="detail.php?hotel_id=<?php
$hotelid = empty($_COOKIE['hotelid'])?0:$_COOKIE['hotelid'];
$hotel_id= explode(",", $hotelid);
echo $hotel_id;
?>">查看详细>></a></td>
</tr>
</table>
</td>
{{/foreach}}