ho messo il form nella stessa pagina e valorizzato le checkbox e sembra tutto funzionare:
Codice PHP:
<h2>Contatti</h2>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['send'])) {
$check = $_POST['check'];
require_once 'lib/phpmailer.inc.php';
$mail = new phpmailer();
$mail->From = 'ChiaraBaschieri.it';
$mail->FromName = "ChiaraBascheri.it";
$mail->Subject = $_POST['subject'];
$mail->Body = $_POST['messaggio'];
foreach ($check as $send) {
$mail->AddAddress($send);
}
$mail->Send();
echo 'Mail inviata correttamente
';
}
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="send_email" onsubmit="return validaEmail();">
<table>
<tr>
<td>Titolo:</td>
<td><input type="text" name="nome" id="titolo" value="" /></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="subject" id="subject" value="" /></td>
</tr>
<tr>
<td>Messaggio:</td>
<td><textarea name="messaggio" rows="8" cols="30">
</textarea>
</td>
</tr>
<tr>
<td><input type="submit" value="Submit" name="send" /></td>
<td></td>
</tr>
</table>
<?php
echo '<div id="demo">';
echo '<table id="example" class="display"><thead>';
echo '<th>[url="javascript:selectAll();"]Select All[/url]</th>';
echo '<th>NOME</th>';
echo '<th>COGNOME</th>';
echo '<th>EMAIL</th>';
echo '<th>SETTORE</th>';
echo '<th>STATO</th>';
echo '<th></th></thead>';
echo '<tfoot>';
echo '<th>[url="javascript:selectAll();"]Select All[/url]</th>';
echo '<th>NOME</th>';
echo '<th>COGNOME</th>';
echo '<th>EMAIL</th>';
echo '<th>SETTORE</th>';
echo '<th>ATTIVATO</th>';
echo '<th></th></tfoot>';
foreach (showUtenti() as $row) {
echo '<tr><td><input type="checkbox" name="check[]" value="' . $row['utente_email'] . '" /></td>';
echo '<td>' . $row['utente_nome'] . '</td>';
echo '<td>' . $row['utente_cognome'] . '</td>';
echo '<td>' . $row['utente_email'] . '</td>';
echo '<td>' . $row['settore'] . '</td>';
if ($row['attivato'] == 0) {
$stato = 'NO';
} else {
$stato = 'SI';
}
echo '<td>' . $stato . '</td>';
echo '<td><a href="modifica.php?id=' . $row['utente_id'] . '&n=' . $row['utente_nome'] . '&c=' . $row['utente_cognome'] . '&e=' . $row['utente_email'] . '&s='
. $row['id_settore'] . '&a=' . $row['attivato'] . '">Modifica</a> | ';
echo '[url="javascript:deleteConfirmation(' . $row['utente_id'] . ')"]Elimina[/url]</td></tr>';
}
echo '</table></div>';
echo '</form>';
echo '<div class="spacer"></div>
';
sicuramente si può fare meglio, ma più di cosi nn sono riuscito a fare.
ciauz!