Hello all,
 
I am no PHP pro and I am modifiying someone else's code.  This code
takes elements from a form (checkboxes) and creates an array from them
and then puts the array into a field in the database.  I need to change
it so it DELETES the checked elements from the existing array and then
puts the modified array into the database field.    Can someone clue me
in?  Here's the current code:
 
$subs = $HTTP_POST_VARS;
  $num_belong2 = 0;
  while(list($val, $cur) = each($subs)) {
   if(stristr($val, "id:")) {
    $num_belong2++;
    $belong[] = $cur;
   }
  }
  if($num_belong2 > 0) {
   $fbelong = "";
   for($t=0; $t<$num_belong2; $t++) {
    $fbelong .= $belong[$t];   
    if($t < ($num_belong2 - 1)) $fbelong .= ",";
   }
   $fbelong.=",";
   if(mysql_query("UPDATE program_plans SET books='$fbelong' WHERE
plan_id='$_POST[id]' LIMIT 1")) {
   header("Location:edit_plan2.php?id=$_POST[id]");
  }
}

 


[Non-text portions of this message have been removed]



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to