mardi 18 juillet 2017

How to update database for the checkbox selected id's and send mail to respective email addresses

I want to send welcome mail to all users whose id gets status 1. I have achieved setting status 1 to those users who are being selected via checkbox but can't figure out how to send email to all who are checked. A suggestion would be helpful.

Here is my code for the same, do let me know what else I need to add for taking 'email' into variable '$check' and send mail.

 <td><input type="checkbox" name="all_check[]" <?php echo $disabled ;?> value= "<?php echo $row['id']; ?>"class="checkbox" id="status" ></td>
                      <input type="hidden" value="<?php echo $row['id']; ?>" name="user_id" id="user_id" >

And, code where I am setting status=1 for the selected users,

                <?php
if(!empty($_POST['all_check'])) {
    foreach($_POST['all_check'] as $check) {
          $update_status= mysql_query("UPDATE tbl_user SET status = '1' WHERE id = $check" );  
  }
}
?>

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire