4

我有来自数据库的图像的 twitter 引导轮播

<div id="myCarousel" class="carousel slide">
          <div class="carousel-inner">
           <div class="item active">
              <img src="images/image1.jpg" alt="zero" width="100%" min-height="10%"/>
              <div class="carousel-caption"><p>ABCD</p></div>
           </div>
          <?php
           session_start();
          $link=mysql_connect('localhost', 'root', '');
          $database="db_name";
          $db_found=mysql_select_db($database,$link);
          $insert=mysql_query("select p.profile_image_path, u.name,u.user_ID from profile p, users u where p.email=u.email");
          $num_rows = mysql_num_rows($insert);
          for ($i=0; $i < $num_rows; $i++) { 
          while($data = mysql_fetch_row($insert)){
            $_SESSION['userid']=$data[2]; /*<img src="'.$data[0].'" alt="zero"  />?id='.$data[2].'&role=2*/
          echo '<div class="item"><form method="POST" action="/Profile">
          <a href="#" onclick="document.forms[0].submit();return false;">
          <input type="image" name="carc" src="'.$data[0].'" />
          <input type="hidden" name="car" value="'.$data[2].'">
          </a></form><div class="carousel-caption"><p>'.$data[1].'</p></div></div>';
            }
          }
              ?>
          </div>
          <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
          <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
        </div>
      </div>

并且我想在单击轮播图像时链接到特定用户的个人资料页面......但实际上使用 POST 方法它只提交循环的第一个值,如果我使用 SESSION 它给出循环的最后一个值。 .

请帮助我...在此先感谢

4

1 回答 1

5

got the solution by my own..... Instead of

<a href="#" onclick="document.forms[0].submit();return false;">

I should have used

<a href="#" onclick="document.forms[].submit();return false;">
于 2013-11-18T10:08:04.067 回答