I'm trying to apply/update a database using a form on a previous page that
uses checkboxes instead of edit fields, and I'm having trouble getting the
correct values from the checkboxes.

My form:

  printf( "<TD  align='center'>" );
  if( $row["approved"] == 1 )
  {
    printf( "<INPUT type='checkbox' name='approved[]' value='ON'
checked>" );
  }
  else
  {
    printf( "<INPUT type='checkbox' name='approved[]'>" );
  }
  printf( "</TD>" );


then calls a php file which contains:


  /* process the periods and update */
  $num_rows = count( $id );
  for( $i = 0; $i < $num_rows; $i++ )
  {

    if( $approved[$i] == 'ON'  )
    {
      $appr = 1;
    }
    else
    {
      $appr = 0;
    }

    /* run the sql statement here */
    $sql_str = "update ".
      "allotee_approval ".
      "set ".
      "pct_ownership = $pct_ownership[$i], ".
      "approved = $appr ".
      "where ".
      "log_unit = $form_log_unit and ".
      "scale_unit = $form_scale_unit and  ".
      "id = '$id[$i]' ";



Jeff.


--
Jeff D. Hamann
Hamann, Donald & Associates, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
Bus. 541-753-7333
Cell. 541-740-5988
[EMAIL PROTECTED]
www.hamanndonald.com




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

Reply via email to