在Popup中获取用户ID

时间:2011-12-08 06:49:29

标签: php

<head>
<link type='text/css' href='css/osx.css' rel='stylesheet' media='screen' />
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type='text/javascript' src='js/osx.js'></script>
</head>
<?php
$myuser = 3;
$a = mysql_query('SELECT cmc.coursemoduleid, cma.sourcecmid, cmc.userid 
                  FROM course_modules_completion, course_modules_availability cma 
                  WHERE cmc.userid = '.$myuser.'');
echo '<table>
        <tr><th>Course Module ID</th><
            <th>Course Module ID</th>
        </tr>';

foreach($a as $aa)
{
  $mid = $aa->coursemoduleid;
  $sid = $aa->sourcecmid; 
  $user = $aa->userid; 
  <tr><td>'.$user.'</td>
      <td>'.$mid.'</td>
      <td>'.$sid.'</td> 
      <td>
        <div id="container">
      <div id="content"><div id="osx-modal"><a href="#" class="osx">View More</a>
           </div></div> 
          <div id="osx-modal-content">          
    <div class="close"><a href="#" class="simplemodal-close">X</a></div>
    <div id="osx-modal-data">';
               echo $user.'Welcome Here';
            </div></div>
      </td>
  </tr>';
}
echo '</table>';
?>

我想在弹出窗口中获取$ user值(如果假设如果$ myuser在表中为6,那么当我点击viewmore时,我甚至应该在弹出窗口中获得6)。我的弹出窗口正好在jquery中没有错误,只需要在弹出窗口中传递$ user值。

现在,它只显示所有弹出窗口中的第一个用户标识9。 有谁能建议我?

1 个答案:

答案 0 :(得分:0)

您需要将用户ID提供给弹出窗口。

<script type='text/javascript'>
  function showUser(userID)
  {
    var userWindow = window.open(url, "User", "width=600,height=400");
  }
</script>

<a href="#" class="osx" onclick="showUser(<?= $user ?>)">