获取到有可能是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}}">查看详细&gt;&gt;</a></td>
      </tr>
    </table>
 </td>
  {{/foreach}}

解决方案 »

  1.   

    比如我选择3个ID后,点击按钮后跳转的页面显示 选择这3个ID的信息就像这个http://hotel.elong.com/listd_cn_2001_0_0_-1_0_23.13535_113.32827_6_1.html?sa=%E4%BD%93%E8%82%B2%E4%B8%AD%E5%BF%83%E5%9C%B0%E9%93%81%E7%AB%99#?通过选择点击加入对比后,点击开始对比跳转到下一个页面,显示选择的全部信息
      

  2.   


    代码修改如下:
    {{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;
     ?>">查看详细&gt;&gt;</a></td>
              </tr>
            </table>
         </td>
      {{/foreach}}