php - Multiple checkbox validation before sql insert -
i have problem similar post:
my issue is, have rather large list of checkboxes need know if checked in order set status of $row. mentioned script,all and's, except have , or thrown in works.
if ( isset($_post['facial1']) && ($_post['facial2']) && ($_post['facial3']) && ($_post['facial4']) && ($_post['intra-oral1']) && ($_post['intra-oral2']) && ($_post['intra-oral3']) && ($_post['intra-oral4']) && ($_post['intra-oral5']) && ($_post['intra-oral6']) && ( ( ($_post['x-ray1']) && ($_post['x-ray3']) ) || ($_post['x-ray5']) ) ) { $status = 1; } else { $status = 0; }
each time run test, gets element not checked throws error: undefined index: xxx. xxx first none checked item.
checkboxes not checked not sent part of post body. code needs use isset:
if ( isset($_post['facial1']) && isset($_post['facial2']) && isset($_post['facial3']) && isset($_post['facial4']) && isset($_post['intra-oral1']) && isset($_post['intra-oral2']) && isset($_post['intra-oral3']) && isset($_post['intra-oral4']) && isset($_post['intra-oral5']) && isset($_post['intra-oral6']) && ( ( isset($_post['x-ray1']) && isset($_post['x-ray3']) ) || isset($_post['x-ray5']) ) ) { $status = 1; } else { $status = 0; }
Comments
Post a Comment