12-25-2016, 07:35 PM
Ok...How about this...
So, then, when the form is submitted, you have both the person selected's id and fname.
So then you can process your form like...
So when you are formulating your query in the example above $key is the id of the person whose box was checked. It is already in a foreach loop so if you do a query, it will do it for every single checked person. You can experiment by doing
Code:
<input type='checkbox' name='utilizator[<?=permOp->id?>]' autocomplete='off' value='<?=$permOp->fname?>'>
So, then, when the form is submitted, you have both the person selected's id and fname.
So then you can process your form like...
Code:
if(!empty($_POST)){
Code:
foreach($_POST['utilizator'] as $key=>$value){
Code:
//run your DB insert for each untilizator here!
Code:
}
Code:
}
So when you are formulating your query in the example above $key is the id of the person whose box was checked. It is already in a foreach loop so if you do a query, it will do it for every single checked person. You can experiment by doing
Code:
foreach($_POST['utilizator'] as $key=>$value){
Code:
dump($key);
Code:
dump($value);
Code:
}
Code:
}