php - Using checkboxes to specify items in array -
i want use checkboxes specify items added array, code follows:
$columns = array( if (isset($_post['customerid'])) { 'customer id' => 'customerid', } if (isset($_post['first_name'])) { 'first name' => 'first_name', } );
how can make work? many thanks
you can't use if statements inside of array, move outside so.
$columns = array(); if (isset($_post['customerid'])) { $columns['customer id'] = 'customerid'; } if (isset($_post['first_name'])) { $columns['first name'] = 'first_name'; }
Comments
Post a Comment