close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to send to all in a dept or depts using checkboxes

Thread began 9/11/2009 2:58 pm by Daryl | Last modified 9/15/2009 6:24 pm by Jason Byrnes | 3532 views | 12 replies |

DarylBeta Tester

How to send to all in a dept or depts using checkboxes

I have created a form which has a list of departments at the top, each with a check box.

I am trying to figure out how to set up UE so that it will send to all email addresses in the department/s with a tick in the box.

I have created a query that retrieves the addresses that have a 1 in the relevant dept column, but can't figure out what to do next.

Sign in to reply to this post

Jason ByrnesWebAssist

The to address can be a comma separated list.

If you create a collection of checkboxes all named "email" and set the value to the email address:
<input type="checkbox" name="email[]" value="dept1@dmain.com" id="email_0" />
<input type="checkbox" name="email[]" value="dept2@domain.com" id="email_1" />
<input type="checkbox" name="email[]" value="dept3@dmain.com" id="email_2" />
<input type="checkbox" name="email[]" value="dept4@domain.com" id="email_3" />

You can set the top address to use the email form element and implode() the array to a comma separated list:
<?php echo ((isset($_POST["email"]))?implode(", ",$_POST["email"]):""); ?>

Sign in to reply to this post

DarylBeta Tester

Thanks Jason

I think I understand where your coming from but need a little more explanation to suit my database etc....

I see how the addresses will be used by UE and how to get them in there, I just can't figure out how to assign the email addresses into the checkbox values.

I have a SQL Statement that extracts all of the records from the database that fulfils the criteria of having an email address and is a member of a department. How do I further filter the results so that I can insert the relevant user(s) from a dept into the relevant dept checkbox?

Sorry - I guess this isn't so much of a UE question now.

Sign in to reply to this post

DarylBeta Tester

Eric gave someone else this method of doing the same thing, wo will give that a go and see how I get on....

  To get started you are going to have to implement a DataAssist Search server behavior onto your add to cart page. You can think of this as your search page, the search will be performed on the values that you have listed with the checkboxes.

You have a recordset that selects all of the records that the user can select with the checkboxes. Once this recordset has been crafted you add the DataAssist Search server behavior to the page. When you configure this you will setup the search criteria to look for values that match the checkbox fields you have. You must ensure that your checkbox fields have the values set the same as the values you will be searching on. For example if you have the record id as the value of the checkboxes you will need to be searching the id column in your recordset where the checkbox value matches that column.

Once you have got this working you will be ready to use the add to cart from recordset server behavior to add all the user selected items to the cart. If you have any problems getting the DataAssist Search server behavior implemented make sure to take a look at the DataAssist support page for additional resources to help you get this in place.  
Sign in to reply to this post

DarylBeta Tester

also a tutorial here that might be worth me looking at too

http://www.kavoir.com/2009/01/php-checkbox-array-in-form-handling-multiple-checkbox-values-in-an-array.html

Sign in to reply to this post

DarylBeta Tester

I think I have got the bulk of this right.

I have created recordsets that get the email addresses from the database.

I have set the checkboxes up as suggested;

php:
<input name="email[]" type="checkbox" id="Chairman" value="<?php echo((isset($_POST["lsdogs_chairman"]))?implode(",",$_POST["lsdogs_chairman"]):""); ?>">



I have configured UE to retrieve the email addresses from the checkboxes etc.

I just can't figure out what to do next to get it to work. - I guess the email addresses need to be sent to the checkboxes some how?

Sign in to reply to this post

DarylBeta Tester

Originally Said By: Jason Byrnes
  The to address can be a comma separated list.

If you create a collection of checkboxes all named "email" and set the value to the email address:
<input type="checkbox" name="email[]" value="dept1@dmain.com" id="email_0" />
<input type="checkbox" name="email[]" value="dept2@domain.com" id="email_1" />
<input type="checkbox" name="email[]" value="dept3@dmain.com" id="email_2" />
<input type="checkbox" name="email[]" value="dept4@domain.com" id="email_3" />

You can set the top address to use the email form element and implode() the array to a comma separated list:
<?php echo ((isset($_POST["email"]))?implode(", ",$_POST["email"]):""); ?>  



Forget all my other posts after the one from Jason. I now realise I have just been confusing myself!

I understand what Jason has suggested, but from what I understand each checkbox would have one email address. What I am looking for is for each checkbox value to hold all email addresses for that department which is retrieved from my database.

Would I just put some sort of while statement in each value? I have tried to research arrays to see if that would help and I think that is what has gotten me so confused.

Sign in to reply to this post

Jason ByrnesWebAssist

My Apologies Daryl, I Think i helped confuse you.

Perhaps an easier way to do this will be to create checkboxes with the department ID as the value:

department 1:<input type="checkbox" name="email[]" value="1" />
department 2:<input type="checkbox" name="email[]" value="2" />
department 3:<input type="checkbox" name="email[]" value="3" />
department 4:<input type="checkbox" name="email[]" value="4" />


and use DataAssist search to filter your users table on the department ID column. in data assist search, create a new filter using the List Fileter type on the email form element to filter the deptID column. Set the Default where to " 0 != 0" so the recordset will initially be empty.

Then in Universal Email, set the to tab to use the recordset loop and set the trigger to if the recordset is not empty.

Sign in to reply to this post

DarylBeta Tester

So, if I have read this right I may need to change my Database structure.

At the moment a user registers with the website, then a check box is used by an admin to indicate that a person is a member of a department (as people can be in more than 1 department). So instead of having value 1, 2, 3 etc in one column, they will have a 1 in each dept column.

The next table that holds emails is one that is entered about a committee, they enter contact details into a form of key positions within that committee and are simply an email address associated to a committee position.

Can I create a search as you described but have multiple criteria so that in the case of table 1 multiple columns are chosen to find items with a value of 1?

With regard to the second table, could i set up multiple criteria that selected all email addresses in each column?

Sign in to reply to this post

DarylBeta Tester

This post has been deleted.

loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...