السلام عليكم ورحمة الله وبركاته
عندي لوحة تحكم برمجها لي صديق لكن نسي وضع زر حدف ايد مساعدة في برمجة امر delet
كود لوحة التحكم على الشكل التالي
<?
include('global.php');
include('header.php');
if($level == 1){
echo'<center>
<table width="70%">
<tr>
<td align="center" colspan="2" style="background:#000000;padding:10px;border: 1px solid #3f3f3f;"><b>Admin</b></td>
</tr>
<tr>
<td align="center" width="200" style="background:#000000;padding:10px;border: 1px solid #3f3f3f;">
<table width="100%">
<tr>
<td align="center" colspan="2" style="background:#000000;border: 1px solid #3f3f3f;"><b>Programme D\'aujourd\'hui</b></td>
</tr>
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=addprog">Add</a></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editprog">Edit</a></td>
</tr>
<tr>
<td align="center" colspan="2" style="background:#000000;border: 1px solid #3f3f3f;"><b>Chaine</b></td>
</tr>
<tr>
<td align="center" colspan="2" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch">Edit</a></td>
</tr>
<tr>
<td align="center" colspan="2" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=logout"><b>Logout</b></a></td>
</tr>
</table>
</td>
<td align="center" style="background:#000000;padding:10px;border: 1px solid #3f3f3f;">';
if($_GET['do'] == 'addprog'){
if($_POST[submit]){
$league = htmlspecialchars($_POST[league]);
$match = htmlspecialchars($_POST[match]);
$chaine = htmlspecialchars($_POST[chaine]);
mysql_query("insert into ".prefix."programme set league='$league',chaine_id='$chaine',`match`='$match'") or die (mysql_error());
echo'Programe Add !';
}else{
echo'
<form method="post" action="">
<table width="100%">
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>League</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Match</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Chaine</b></td>
</tr>
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="league" size="20"></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="match" size="20"></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="chaine" size="20"></td>
</tr>
<tr>
<td align="center" colspan="3" style="background:#000000;border: 1px solid #3f3f3f;"><input type="submit" name="submit" value="Add"></td>
</tr>
</table>
</form>';
}
}elseif($_GET['do'] == 'editprog'){
if($id > 0){
if($_POST[submit]){
$league = htmlspecialchars($_POST[league]);
$match = htmlspecialchars($_POST[match]);
$chaine_id = htmlspecialchars($_POST[chaine_id]);
mysql_query("update ".prefix."programme set league='$league',`match`='$match',chaine_id='$chaine_id' where id = '$id'") or die (mysql_error());
echo'Programe Edit !';
}else{
$ProSQL = mysql_query("select * from ".prefix."programme where id = '$id'") or die (mysql_error());
if (mysql_num_rows($ProSQL) > 0){
while($ProSource = mysql_fetch_array($ProSQL)){
echo'
<form method="post" action="direction.php?do=editprog&id='.$id.'">
<table width="100%">
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>League</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Match</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Chaine</b></td>
</tr>
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="league" size="20" value="'.$ProSource[league].'"></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="match" size="20" value="'.$ProSource[match].'"></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="chaine_id" size="20" value="'.$ProSource[chaine_id].'"></td>
</tr>
<tr>
<td align="center" colspan="3" style="background:#000000;border: 1px solid #3f3f3f;"><input type="submit" name="submit" value="Edit"></td>
</tr>
</table>
</form>';
}
}
}
}else{
echo'<table width="50%">';
$ProSQL = mysql_query("select * from ".prefix."programme order by id desc") or die (mysql_error());
if (mysql_num_rows($ProSQL) > 0){
while($ProSource = mysql_fetch_array($ProSQL)){
echo'<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editprog&id='.$ProSource[id].'"><b>ID '.$ProSource[id].' : '.$ProSource[match].'</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;">
</td></tr>';
}
}
echo'</table>';
}
}elseif($_GET['do'] == 'editch'){
if($id > 0){
if($_POST[submit]){
$source = $_POST[source];
mysql_query("update ".prefix."chaine set source='$source' where id = '$id'") or die (mysql_error());
echo'Chaine Edit !';
}else{
$ChSQL = mysql_query("select * from ".prefix."chaine where id = '$id'") or die (mysql_error());
if (mysql_num_rows($ChSQL) > 0){
while($ChSource = mysql_fetch_array($ChSQL)){
echo'
<form method="post" action="direction.php?do=editch&id='.$id.'">
<table width="100%">
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Chaine '.$id.'</b></td>
</tr>
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><textarea name="source" cols="50" rows="10">'.$ChSource[source].'</textarea></td>
</tr>
<tr>
<td align="center" colspan="3" style="background:#000000;border: 1px solid #3f3f3f;"><input type="submit" name="submit" value="Edit"></td>
</tr>
</table>
</form>';
}
}
}
}else{
echo'
<table width="50%">
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=1"><b>Chaine 1</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=2"><b>Chaine 2</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=3"><b>Chaine 3</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=4"><b>Chaine 4</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=5"><b>Chaine 5</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=6"><b>Chaine 6</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=7"><b>Chaine 7</b></a></td></tr>
<tr><td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><a href="direction.php?do=editch&id=8"><b>Chaine 8</b></a></td></tr>
</table>';
}
}
echo'
</td>
</tr>
</table>';
}else{
if($_POST[submit]){
if($_POST[username] == $config[username] and $_POST[password] == $config[password]) {
$_SESSION[username] = $_POST[username];
$_SESSION[password] = $_POST[password];
head('direction.php');
}
}
echo'
<table width="100%" height="200">
<tr>
<td align="center"><br><br><br><br>
<form method="post" action="">
<table style="background:#000000;padding:10px;border: 1px solid #3f3f3f;" cellSpacing="0" cellPadding="0" width="50%">
<tr>
<td colspan="2" style="padding-left:10px;border: 1px solid #3f3f3f;"><b>Admin Panel</b></td>
</tr>
<tr>
<td align="center" width="200" style="background:#000000;border: 1px solid #3f3f3f;"><b>UserName :</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input name="username" size="40"></td>
</tr>
<tr>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><b>Password :</b></td>
<td align="center" style="background:#000000;border: 1px solid #3f3f3f;"><input type="password" name="password" size="40"></td>
</tr>
<tr>
<td align="center" colspan="2" style="background:#000000;border: 1px solid #3f3f3f;"><input type="submit" name="submit" value="login"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>';
}
include('footer.php');
?>اريد زيادة امر
<a href="direction.php?do=delprog&id='.$ProSource[id].'"><b>X</a>
لكن انا مبتدىء في php
واريد مساعدتك وجزاكم الله خير