PDA

View Full Version : مشکل دردریافت ای دی از صفحه قبل



jariyan
سه شنبه 21 تیر 1390, 19:22 عصر
با درود من
من یک لیست از اعضای سایتم دارم و در جدول نمایش داده می شه و کنار دکمه delete قرار دادم
و بعد وقتی دکمه delete می زنم می خوام اطلاعات همان شخص رو نشون داده و بعد پاک کنه البته فعلا مشخصات رو نشون ندادم فقط می خوام پاک کنه ولی هر کاری می کنم انجام نمی ده .
جدول اطلاعات


<?php
session_start();
$con = mysql_connect("localhost","test","12345");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("university", $con);

$result = mysql_query("SELECT * FROM members");
echo "<table class='ewTable'>
<tr class='ewTableHeader' >
<th> Number </th>
<th> Firstname </th>
<th>Lastname</th>
<th>Usarname</th>
<th>password</th>
<th>mail</th>
<th>Delete User</th>
</tr>";
$nRecCount = 0;
while($row = mysql_fetch_array($result))
{
$nRecCount++;
echo "<tr>";
echo "<td>" . $row['member_id'] . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['mail'] . "</td>";
echo "<td><a href=dls.php?member_id=$row[member_id]>Hapus</a></td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>


و delete



<?php
session_start();

$con = mysql_connect("localhost","test","12345","university");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (isset($_GET["member_id"])) {
$result = mysql_query("DELETE FROM members WHERE member_id='$_GET[member_id]'");

echo "nodelete";
exit;
} else {
//send them somewhere else
echo "nodelete";
exit;
}
mysql_close($con);
?>


بدون form

googoli
سه شنبه 21 تیر 1390, 19:50 عصر
این کد رو امتحان کد شاید بدردت بخوره البته این کد با فرم هست


<?
$access='';
$ok_cookie = false;
include('signin.php');
if (!$ok_cookie) {exit;}
if (isset($_REQUEST['bankname'])) $bankname=$_REQUEST['bankname'];
require_once("../include/connect.php");
$select="select * from $bankname";
$query=mysql_query($select);
$result=mysql_num_rows($query);
if (isset($_REQUEST['submit_delete'])) {
$username = $_REQUEST['username'];
if (count($username)>0) {
foreach ($username as $idvalue){
$query=mysql_query("delete from $bankname where userid='$idvalue'") or die (mysql_error());
}
}

}
$link='insert_user.php';
?>
<html>
<head>
<LINK REL="StyleSheet" HREF="main.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
</head>
<script>
function doToolBarAction(buttonAction) {
document.listManager.action.value = buttonAction;
document.listManager.submit();
}
function checkAll(oElement) {
oForm = oElement.form;
oElement = oForm.elements[oElement.name];
if(oElement.length)
{
bChecked = oElement[0].checked;
for(i = 1; i < oElement.length; i++)
oElement[i].checked = bChecked;
}
}
function overing(iid){
document.all[iid].bgColor='#A7A7A7'
}
function outing(iid,idbgcolor){
document.all[iid].bgColor=idbgcolor
}
</script>
<body>
<br />
<div align="right">
<form target="main" id="myform">
<input <?php if (!ereg('G',$access)){echo 'disabled';}?> type="Button" value="حذف" onmouseover="style.cursor='pointer'"style="font-family:tahoma;font-size:11;" onclick="doToolBarAction('delete');" >
<input <?php if (!ereg('G',$access)){echo 'disabled';}?> type="Button" value="رکورد جديد" onmouseover="style.cursor='pointer'" style="font-family:tahoma;font-size:11;" onclick="window.open('<?echo $link;?>?bankname=<?echo $bankname;?>','_self')">
</form></div>
<form id="listManager" name="listManager" method="GET">
<input type="Hidden" name="bankname" value="<?php echo $bankname; ?>">
<input type="Hidden" name='delete_submit' value='1'>
<div align='center'>
<?for($i = 1; $i <= $total_pages; $i++)
echo "<font face='Tahoma' size='3' color='blue'><a href=\"".$cpage."?bankname=$bankname&safhe=$i\">$i </a></font>";
?>
</div>
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="15%">
<tr bgcolor="#E4E9E8" valign="baseline">
<td align="center" width="5%" height="5%"><font face="Tahoma" size="2" color="red">ويرايش</font></td>
<td align="center" width="15%" height="5%"><font face="Tahoma" size="2" color="red">ip</font></td>
<td align="center" width="50%" height="5%"><font face="Tahoma" size="2" color="red">نام کاربري</font></td>
<td align="center" width="37%" height="5%"><font face="Tahoma" size="2" color="red">آخرين ورود</font></td>
<td align="center" width="5%" height="5%"><font face="Tahoma" size="2" color="red">رديف</font></td>
<td align="center" width="3%" height="5%"><input type="checkbox" id="checkall" name="checkall" onclick="checkAll(this);" /></td>
</tr>
<?while ($row=mysql_fetch_assoc($query)) {
$counter++;
if ( ($counter % 2) ) {$bgcolor = "DDFFF3";} else { $bgcolor = "EAEEFE"; }?>
<tr bgcolor="<?php echo $bgcolor?>" id="<?php echo $counter?>" >
<td align="center" width="5%" height="5%"><img src="../images/edition.gif" width="25" height="25" alt="" onclick="window.open('<?php echo $link;?>?code=<?php echo $row['code'];?>&bankname=<?php echo $bankname?>','_self')" onmouseover="style.cursor='pointer'" /></td>
<td align="center" width="15%" height="5%"><font face="Tahoma" size="2" ><?php echo $row['ip'];?></font></td>
<td align="center" width="50%" height="5%"><font face="Tahoma" size="2" ><?php echo $row['username'];?></font></td>
<td align="center" width="37%" height="5%"><font face="Tahoma" size="2"><?php echo $row['date'];?></font></td>
<td align="center" width="5%" height="5%"><font face="Tahoma" size="2"><?php echo $row['code'];?></font></td>
<td align="center" width="3%" height="5%"><input id="checkall" name="idaccount[]" value="<?php echo $row['code'];?>" type="checkbox" /></td>
</tr>
<?}?>
</table>
</form>
<?php
mysql_free_result($query);
mysql_close($connect);
?>

</body>
</html>

jariyan
سه شنبه 21 تیر 1390, 20:38 عصر
ممنون ولی مشکل من این نیست مشکل من ارسال آی دی و دریافت اونه البته بدون فروم
و برای کد شما خیلی سطحش بالا هستش