I'm doing some unpaid work for our elementary school an looking for an Solution to pass an JS result to an php array...
$('.__results__`lastname [type="checkbox"]:checked').each( (indx, el) => {
        let name = $(el).parents('.__results__lastname').attr('data-name'),
        html += `
            <tr class="_lastnames_total">
                <td class="leftReview"><b>Lastname: <span >${name}</span></b></td>
            </tr>
        `;
The result of $(name) must be passed to php as an array
$postfields = array (
"username" => USER,
"password" => md5(PASS),
"action" => 'addlastnames',
"responsetype" => "json",
"lastname" => array('lastname1', 'lastname2', 'lastname3', ),
);
and i have no idea... any help would be awesome!
