PHP超链接/弹出表

时间:2012-04-16 01:54:59

标签: php mysql hyperlink html-table popup

我正在从MySQL查询创建一个PHP表,如下所示:

    $resultkulim = mysql_query("SELECT customer_name, zone_name, segment_code, COUNT(segment_code) FROM complete_wk where zone_name = 'ZONE KULIM' and (segment_code = 's30' or segment_code='s40' or segment_code='s50'')");
    $totalrrkulim = mysql_query("SELECT zone_name, repeat_rc, COUNT(repeat_rc) FROM complete_wk where zone_name = 'ZONE KULIM' and repeat_rc>1 and (segment_code = 's30' or segment_code='s40' or segment_code='s50')");

                echo "<table class='table1'>";
                echo "<thead>";
                    echo "<tr>";
                        echo "<th>Zone</th>";
                        echo "<th>Total TR</th>";
                        echo "<th>Total RR (RR>1)</th>";
                        echo "<th>%RR</th>";
                    echo "</tr>";
                echo "</thead>";
                //kulim row
                while($rowkulim = mysql_fetch_array($resultkulim))
                  {
                        echo "<tbody>";
                        echo "<tr>";
                            echo "<td>Zone Kulim</td>";
                            echo "<td >" . $rowkulim['COUNT(segment_code)'] . "</td>";
                      while($rrkulim = mysql_fetch_array($totalrrkulim))
                          {
                            $myresultkulim = $rrkulim['COUNT(repeat_rc)'] / $rowkulim['COUNT(segment_code)'] * 100;
                                  echo "<td>" . $rrkulim['COUNT(repeat_rc)'] . "</td>";
                                  echo "<td>" . number_format($myresultkulim) . "%" . "</td>";
                              echo "</tr>"; 
                            echo "</tbody>";
                          }
                  }
                echo "</table>";

该表的示例结果如下:

Zone         Total TR    Total RR    %RR
Zone Kulim     182          11        6%  

我想要做的是,我希望能够点击Total TR的结果,即“182”,它将带我到其他页面,其中包含该182结果的详细信息表。

我已经完成了另一张桌子,它位于“localhost / tmj / index.php / tr / kulim”

我希望有人可以告诉我如何从上面的表格代码创建一个弹出窗口或超链接到其他页面。

1 个答案:

答案 0 :(得分:0)

我不确定这是不是你想要的, 试试

echo '<td ><a href="index.php/tr/kulim">' . $rowkulim['COUNT(segment_code)'] . "</a></td>";

或者这是一个动态链接?