/    Sign up×
Community /Pin to ProfileBookmark

Adding a "select all" option with checkboxes

Forgive my ignorance on this, but I can’t seem to find it anywhere. I have a form that visitors use to subscribe to my newsletters. As of right now, I have one preselected (my main newsletter) and the rest the reader must check to select which ones they want to subscribe to.

I would like to allow people the option of a “select all” box, so if they want to subscribe to all the newsletters, they can do so with one click of the mouse instead of having to click each one individually. I know this can be done, I’ve seen it, but can’t locate one now to view the coding.

Here’s the page where the form resides
[url]http://www.familycorner.com/services/lists.shtml[/url]

Here’s the basics of the script:

<form name=”” method=”post” action=”/12all/box.php”>

Your name:
<input name=”name” type=”text” id=”name” value=”” size=”16″>
<P>
Your email address:
<input name=”email” type=”text” id=”email” value=”” size=”16″>

<input type=”checkbox” name=”nlbox[16]” value=”5″ checked> <FONT size=2><b>What’s New Update</b> </FONT>

<input type=”checkbox” name=”nlbox[7]” value=”6″> <FONT size=2><b>Education Corner</b></FONT>

<input type=”checkbox” name=”nlbox[6]” value=”7″> <FONT size=2><b>Creativity Corner</b></FONT>

<input type=”checkbox” name=”nlbox[15]” value=”8″> <FONT size=2><b>Time To Eat</b></FONT>

<input name=”funcml” type=”radio” value=”add” checked>Subscribe
<br>
<input name=”funcml” type=”radio” value=”unsub2″>Unsubscribe
<P>
<input name=”p” type=”hidden” id=”p” value=”3″>

<input type=”submit” name=”Submit” value=”Submit”>
<P>
</form>


———————————————————-

That’s the basics of the script, there are more checkboxes but I didn’t include them as you can get the idea above ?

If anyone can help me with this, I sure would appreciate it!

Amanda Formaro, President
FamilyCorner.com Magazine, Inc.
[url]http://www.familycorner.com[/url]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 04.2005 — You'll probably need to do the select all thing via JavaScript, as that sort of thing normally runs on the client side. I'm sure the gurus in the JavaScript forum could show you how to do that. However, since not everyone has JS enabled on their browser, you could have a PHP backup: if the "select all" box is checked, then subscribe them to all regardless of whether they are checked or not.
Copy linkTweet thisAlerts:
@FamilyCornerauthorMay 05.2005 — Bummer ? I have to use this form as far as I know. It's through a list program I purchased. Thank you for your help!
Copy linkTweet thisAlerts:
@scragarMay 05.2005 — [code=php]<script type="text/javascript"><!--
function chooseBoxes(obj){
var DeForm = obj.form;
var DeInputs = DeForm.getElementsByTagName("INPUT");//use lower case input for XHTML
for(var i = 0; i < DeInputs.length; i++){
if(DeInputs[i].type == 'checkbox')
DeInputs[i].checked = obj.checked;
};
};
//-->
</script>

...
</head>
<body>
.....

<form name="" method="post" action="/12all/box.php">
Your name:
<input name="name" type="text" id="name" value="" size="16">
<P>
Your email address:
<input name="email" type="text" id="email" value="" size="16">

<input type="checkbox" onclick="chooseBoxes(this)"
name="pickall" value="5"><span style="font-size: 80%; font-weight: bold;">select all</span>

<input type="checkbox" name="nlbox[16]" value="5" checked> <FONT size=2><b>What's New Update</b> </FONT>

<input type="checkbox" name="nlbox[7]" value="6"> <FONT size=2><b>Education Corner</b></FONT>

<input type="checkbox" name="nlbox[6]" value="7"> <FONT size=2><b>Creativity Corner</b></FONT>

<input type="checkbox" name="nlbox[15]" value="8"> <FONT size=2><b>Time To Eat</b></FONT>

<input name="funcml" type="radio" value="add" checked>Subscribe
<br>
<input name="funcml" type="radio" value="unsub2">Unsubscribe
<P>
<input name="p" type="hidden" id="p" value="3">


<input type="submit" name="Submit" value="Submit">
<P>
</form>[/code]
Copy linkTweet thisAlerts:
@nofollowNov 02.2005 — Hi,

this script seems good to manage multi newsletters.

How many recipients can it handle?

I'am searching for a newsletter/mailinglist-script witch can handle a lot of recipients.


greets

nofollow
×

Success!

Help @FamilyCorner spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...