Hi,

i have a form on a page which is built dynamically and consists of fields in
a certain table and checkboxes. The puropse of the form is to update the the
status of a table called CMS_FIELDS which stores data of all the fields for
all the tables in the database.

Using the following code i am attempting to update the table depending on
whether the boxes have been ticked or not, but the script only outputs
values of the boxes that have been ticked. (the data isn't being updated yet
i am just printing it to the screen for testing purposes).

      if(isset($update_fields)==true){
       $fields='';
       $values='';
       foreach ($_POST as $key => $val) {
         $fields[] = $key;
         $values[] = $val;
       }
       $i=0;
       foreach ($fields as $val){
        if ($values[$i] == "on"){
         $query = "UPDATE CMS_FIELDS SET cms_fields_is_editable = '1'
               WHERE cms_table_name = '$_GET[table_name]' AND cms_field_name
= '".$fields[$i]."'";
        }else {
         $query = "UPDATE CMS_FIELDS SET cms_fields_is_editable = '0'
               WHERE cms_table_name = '$_GET[table_name]' AND cms_field_name
= '".$fields[$i]."'";
        }
        echo "$query<br>";
        $i++;
       }
      }

How can i get the script to look at all of the values sent from the form
(ticked or unticked)?

thanks for your help



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to