View Single Post
ישן 15-01-09, 15:53   # 7
Megnum
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: May 2007
מיקום: אשד
הודעות: 1,308

Megnum לא מחובר  

סיבכתם אותי חח..
אני מנסה לעדכן ת כל הנתונים בטופס יחדיו.
הנתונים עוברים בהצלחה במערך אבל פקודת הSQL פשוט לא עובדת
והיא נכונה כי בדקתי אותה מחוץ למערך
זה הקוד המלא:


PHP קוד:
elseif (isset($_POST[update])) {
foreach (
$_POST[deletoption] as $deleted) {
$query=mysql_query("delete from category_mode where `id`='$deleted'");
}

for(
$index =$index count($_POST[id]); $index++) {

echo 
$_POST[id][$index],"->"$_POST[cat][$index], "<br/>";

$query2=mysql_query("update `category_mode` set `name`='$_POST[cat][$index]' where `id`='$_POST[id][$index]'"); 

}

}

echo 
"<form method='post' name='delete' action=''>\n";
$category=mysql_query("select * from category_mode order by `id` asc");
echo 
"<table class='table' border='0' width='970px'>\n";
while (
$cat=mysql_fetch_array($category)) {
echo 
"<tr valign='top'><td width='200px' valign='top'><input type='hidden' class='name' type='text' name='id[]' value='$cat[id]' /><input class='name' style='width: 200px;' type='text' name='cat[]' value='$cat[name]' /></td><td><select name='deletoption[]'><option value='$cat[id]' name='$cat[id]'>מחק</option><option value='' name='' selected>ללא פעולה</option></select></td>\n";
echo 
"</tr>";
}
echo 
"<tr><td width='200px'><input type='submit' name='update' value='עדכן' /></td><td></td></tr>\n";

echo 
"<table>";
echo 
"</form>\n"

Last edited by Megnum; 15-01-09 at 15:58..
  Reply With Quote