Hello Everybody

In Php iam using the checkbox and it has been one month i can not solve it; when i select one checkbox from several ones , and i click send e-mail= it is sending to all e-mails; it is not sending to the selected checkbox ; I need guys help with it pls,if you guy s need more info let me know and check attached files thks
regards

Recommended Answers

All 11 Replies

First of all, why do you have different name for checkboxes ? You can create a checkbox array by giving the same name for the checkboxes. Then, on page submit, only those checkboxes which were selected will be posted to the next page. I don't know what exactly your script does as I can't figure out what's the relation between users.php and checked.php .

i will put a small note: in the admin use; i add e-mails ; so each e-mail is added in my script will lead to an added email checkbox in the users.php thru sql, that has been done perfectly

my script is to send e-mail to clients to the selected one,
; BUT when i select one checkbox is still sending to all clients, while the checkbox is working fine but i can not prgram to select only one checkbox email at a time to select to only for example to 1 client= it keeps sending to all

i mean i do step 1 , users will open; will give me the list of e-mails and in

step 2 ; i choose from the list

step 3 ; i click send - still sending to all or (if i chnage the phrase i included in the pic info ) will not send at all

and also thanks for having a reply from u

People anybody can help me in this;

what you can do is

<input type="checkbox" name="emails[]" value="user1@domain.com" />

<input type="checkbox" name="emails[]" value="user2@domain.com" />

<input type="checkbox" name="emails[]" value="user3@domain.com" />

After the form submission you'll have an array with emails. The emails in checkboxes should be populated when you render the table.

You can access them using this:

<?php

$emails = empty($_REQUEST['emails']) ? array() : (array) $_REQUEST['emails'];

foreach ($emails as $email) {
   // do something
   send_email($email);
}
?>

Hi..
Try to do this....may be it will work..exactly i too dont know..

<form name=frm method =post>

what you can do is

<input type="checkbox" name="emails[]" value="user1@domain.com" />

<input type="checkbox" name="emails[]" value="user2@domain.com" />

<input type="checkbox" name="emails[]" value="user3@domain.com" />

After the form submission you'll have an array with emails. The emails in checkboxes should be populated when you render the table.

You can access them using this:

<?php
$artwork =@addslashes($_POST['emails']);
$artwork=(!empty($_POST['emails'])? array_map('stripslashes',$_POST['emails']) : ''); 


echo $mail_body='<style type=text/css><!--td {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}--></style>
<table width="50%"  border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#E7E7E7">
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
        <input type="hidden" name="emails" value="ok">
        <tr>
<td>Services </td>
          <td>:</td>
          <td>		 
		  '.(is_array($artwork)? implode(",",$artwork) : '').'

		  
		  </td>
</tr>
?>

just do this...

Dear helpful guys; i thanks for having nice replies, i got your ideas

but the thing is that; in my php files i have one ; that will add my e-mails directly to sql and i will attach the pic, so when i come back to To Users and select one Email from it

in which checkbox is already created for the e-mail not to put that one by one; the selection still taking all selected e-mails and not one; something is easy and i can not figure that out yet; pls help is needed as much you can ; you can add me on recoverysignals@hotmail.com
on msn so i be more helpful

dear guys

my script is based on 2 files of php; one is the SEND and one is the CHEKBOX selection
and the files are attached on the top of my forum and again thanks

regards

Helpful people

When i click send i got this message also when i select in To Users one e-mail ; and if i remove that phrase in php i get a green light ok ; but the e-mail is not send, selection still not working for one ;

pls see the pic

Any New Ideas guys

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.