PHP,MYSQL数组从表单复选框到变量

Im creating a form which has multiple checkboxes based on a sql query so the results values are usually always different

<input type="checkbox" name="warrior[]" value="<? echo $warrior_id; ?>">

but i dont know how to take the values of the boxes that the user has checked from the array. Each checkbox has the id of a row in my database.

I need to run each id that is checked in another query to bring up more details i need for the rest of the script.

"SELECT col1, col2 FROM table WHERE id='$????'"

There is up to 10 values in the array (up to 10 checkboxes)

Thank you for any advise

In HTML

<input type="checkbox" name="warrior[]" value="<? echo $warrior_id; ?>">

In PHP - you can implode checked value array. and check with IN in your database

$getvalues = $_GET['warrior']; //only for example i am using this. you have to filter and do validation on it.
$getImplodeValue = implode(',', $getvalues);

$sqlQuery = "SELECT col1, col2 FROM table WHERE id IN '$getImplodeValue'";
  1. check your validation

2.Then use below:

$getWarrior = $_REQUEST['warrior'];  //get value 

$arrWarrior = '';

if(!empty($getWarrior))
{          
  $arrWarrior = implode(',', $getWarrior);
}

$sqlQuery = "SELECT col1, col2 FROM table WHERE 1";
if(!empty($arrWarrior))
{
   $sqlQuery .= " and id IN ($getImplodeValue)";
}