查看: 796|回复: 0
|
关于一些php的问题,小弟想请教大大们的帮助
[复制链接]
|
|
这个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'>";
}
?>
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|