佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 796|回复: 0

关于一些php的问题,小弟想请教大大们的帮助

[复制链接]
发表于 28-6-2013 08:20 PM | 显示全部楼层 |阅读模式
这个page是由table组成,table里的Category Name是从database里拿出来的。。我面临的问题是,当我要edit这个名字时,我需要按那个"Edit"的link,它就会pop-out 一个小window出来,那么我要怎样send php的parameter去呢?要放那里?
还有小弟的delete link那里,为什么我delete不到?有什么问题吗?希望大大们可以指教指教。。感激不尽 (小弟明白没有天下的午餐,如果有哪位大大能帮忙可是要收费的,小弟是可以接受的,只要价钱不要太贵)

<script language="javascript" type="text/javascript">
  $(document).ready(function() {
        $('a.popoutwindow1').click(function() {
                               
                // Getting the variable's value from a link
                var popoutbox = $(this).attr('href');


                //Fade in the Popup and add close button
                $(popoutbox).fadeIn(300);
                               
                //Set the center alignment padding + border
                var popMargTop = ($(popoutbox).height() + 24) / 2;
                var popMargLeft = ($(popoutbox).width() + 24) / 2;
                               
                $(popoutbox).css({
                        'margin-top' : -popMargTop,
                        'margin-left' : -popMargLeft
                });
                               
                // Add the mask to body
                        $('body').append('<div id="mask"></div>');
                        $('#mask').fadeIn(300);
                               
                        return false;
        });
</script>

<body>
<!----- Table ----->
<div class="table">
        <table id="ttable5">
                <thead>
                  <tr>
                     <th id="tableheader">Category</th>
                     <th class="sort-date" id="tableheader">Updated</th>
                     <th id="tableheader">Action</th>
                  </tr>
                </thead>
<?php
while($row = mysql_fetch_assoc($result))
{
?>
                <tr>
                    <td><?php echo $row["CategoryName"]; ?></td>
                    <td><?php echo $row["CategoryUpdate"]; ?></td>
                    <td>
                        <a href="#popoutbox1" class="popoutwindow1" title="Edit"><img id="icon" src="images/edit.png"></a>
                        <a href="<?php echo $_SERVER['PHP_SELF'];?>?del=<?php echo $row['CategoryID']; ?>" title="Delete"><img id="icon2" src="images/delete.png"></a>
                    </td>
                </tr>
<?php
        }       
?>
        </table>


<!-- Pop-out window (Edit) -->
<form name="popoutedit" method="post" action="">
        <div id="popoutbox1" class="login-popup1">
                <a href="#" class="close"><img src="images/close_pop.png" class="btn_close1" title="Close Window" alt="Close" /></a>
                <div>
                        <div id="popouttitle">
                                <span id="popouttitletxt1">Edit Category Name</span>
                        </div>
               
                        <div id="txtboxcontent">
                                <label id="labeltxt">Current Name :</label>
                                <input id="inserttxt1" type="text" name="oldcatname" readonly value="">
                                                                       
                                <label id="labeltxt">New Name <span id="labeltxt1">:</span></label>
                                <input id="inserttxt2" type="text" name="newcatname" placeholder="Enter new category name here...">
                        </div>


                        <div><input id="popoutbtn1" type="submit" name="editbtn" value="Save"></div>
                </div>
        </div>
</form>
</body>


<?php
if (isset($_GET["del"]))
{
        $id= $_GET["del"];
               
        $sql = "DELETE FROM category WHERE CategoryID = $id";
        $result= mysql_query($sql) or die("Failed".mysql_error());
               
        echo "<meta http-equiv='refresh' content='0;url=index.php'>";
}
?>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-9-2025 02:53 AM , Processed in 0.143341 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表