如何在弹出窗口中显示php mysql选择值

时间:2015-02-16 06:06:07

标签: php html mysql css ajax

我想将mysql选择值(UID)传递给css popup.t这是我试过的代码。但是它显示空文本框。点击删除按钮时弹出按钮显示。我想要将relavent用户UID传递给弹出窗口。

    <table  class="table table-striped table-bordered responsive">
                            <thead>
                            <tr>
                                <th>User ID</th>
                                <th>Facebook ID</th>
                                <th>Name</th>
                                <th>E-mail</th>
                                <th></th>

                            </tr>
                            </thead>
                            <tbody>
                              <tr>  
                          <?php

                        $query = 'SELECT * FROM Users ';
                        $result = mysql_query($query);
                        while($row = mysql_fetch_assoc($result))
                            {   

                            echo '<tr>';
                            echo '<td>'.$row['UID'].'</td>';
                            echo '<td  class="center">'.$row['Fuid'].'</td>';
                echo '<td class="center">'.$row['Ffname'].'</td>';
                echo '<td  class="center">'.$row['Femail'].'</td>';
                echo '<td>'.'<a href="#" class="btn btn-info btn-setting" >'.'Delete'.'</a>'.'</td>';
                echo '</tr>';   
                }                           
                ?>
                </tr>
                 </tbody>
                  </table>

 <form action="db_sql/db_delete_supplier.php" method="post" name="frm1" id="frm1" >
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">

            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">×</button>
                        <h3>Delete Supplier</h3>
                    </div>
                    <div class="modal-body">
                      <p>Are you sure to delete this supplier from system ...? </p>
                    </div>
                    <div class="modal-footer">
                    <input type="text" name="UID" value="<?php echo $row['UID'];?>" />
                        <!--<a href="user.php" class="btn btn-default" data-dismiss="modal" name="no">Close</a>
                        <a href="db_sql/db_delete_supplier.php" class="btn btn-primary" data-dismiss="modal" name="yes">Delete</a>-->
                        <input type="submit" class="btn btn-default" name="no" value="Close" />
                         <input type="submit" class="btn btn-primary" name="yes"  value="Delete"/>
                    </div>
                </div>
            </div>
        </div>
    </form>

Users Table

1 个答案:

答案 0 :(得分:0)

<?php echo "<a href=\"popup.php?cat_id=".$row["cat_id"]." \">Edit</a>"; ?>

将此代码放入While循环中,这样就会打开带有cat-id查询字符串的弹出窗口。

现在,您可以从该ID获取弹出窗口中的所有记录。

这是可以做到的解决方案....

注意:您可以传递任何唯一的ID,以便您可以在弹出页面上执行选择查询,它将从数据库中获取数据