THE QUESTION?
well when i check an item it inserts just fine but when it's unchecked... if was checked, that item well not delete... so i know my code is not right for this but i don't know what path to take... it seems to me that else should be ____ may-be and.... is there and? Any ideas would be helpful... thanks
Here is the code unit try one:
Code: Select all
if ($picked = true) {
foreach ($HTTP_POST_VARS['mark'] as $key=>$val) {
$sql_data_array = array('products_id' => tep_db_prepare_input($val['products_id']),
'extra_fields_type_id' => 'extra_fields_type_id');
tep_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_EXTRA_FIELDS . " (products_id, extra_fields_type_id) VALUES (" . tep_db_input((int)$_GET['pID']) . ", " .tep_db_input($key) . ") ON DUPLICATE KEY UPDATE products_id=" . tep_db_input((int)$_GET['pID']) . ", extra_fields_type_id=" .tep_db_input($key) . ";");
tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'WORKING INSERT INTO cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product', 'NONSSL'));
}
break;
} else {
foreach ($HTTP_POST_VARS['mark'] as $key=>$val) {
$sql_data_array = array('products_id' => tep_db_prepare_input($val['products_id']),
'extra_fields_type_id' => 'extra_fields_type_id');
tep_db_query("DELETE FROM " . TABLE_PRODUCTS_TO_EXTRA_FIELDS . " WHERE extra_fields_type_id=" . tep_db_input($key) . " and products_id=" . tep_db_input((int)$_GET['pID']) . ";");
tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'WORKING DELETE FROM cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product', 'NONSSL'));
}
break;}
}
}Code: Select all
if ($picked = true) {
foreach ($HTTP_POST_VARS['mark'] as $key=>$val) {
$sql_data_array = array('products_id' => tep_db_prepare_input($val['products_id']),
'extra_fields_type_id' => 'extra_fields_type_id');
tep_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_EXTRA_FIELDS . " (products_id, extra_fields_type_id) VALUES (" . tep_db_input((int)$_GET['pID']) . ", " .tep_db_input($key) . ") ON DUPLICATE KEY UPDATE products_id=" . tep_db_input((int)$_GET['pID']) . ", extra_fields_type_id=" .tep_db_input($key) . ";");
}
} else {
foreach ($HTTP_POST_VARS['mark'] as $key=>$val) {
$sql_data_array = array('products_id' => tep_db_prepare_input($val['products_id']),
'extra_fields_type_id' => 'extra_fields_type_id');
tep_db_query("DELETE FROM " . TABLE_PRODUCTS_TO_EXTRA_FIELDS . " WHERE extra_fields_type_id=" . tep_db_input($key) . " and products_id=" . tep_db_input((int)$_GET['pID']) . ";");
}
} tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'WORKING DELETE FROM cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product', 'NONSSL')); break;}
}