/    Sign up×
Community /Pin to ProfileBookmark

one form with checkboxes subscribe to multiple newsletters

I’m looking for one form that will allow users to subscribe to multiple (3) newsletters at once. They will do this by ticking checkboxes to select/deselect the newsletters they want to subscribe to.

I want to use this to allow my confirmed subscribers to also subscribe to other selected newsletters.

I’ve seen this on other pages but cannot figure out how to do it.

Any solution will be appreciated.

thanks,
jimo47

I probably posted this in the wrong category. Perhaps it belongs in the clientside category.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@mayooresanApr 09.2008 — you need to check which text boxes are selected and then you can continue your process...



Remember that checkboxes with the same name work in a group, and the form will pass their value as an array. However, in your form you should tell explicitly that the checkboxes should pass their value as an array. For example:

[FONT=courier][COLOR=blue]<input type="checkbox" name="state[]" value="NE">



<input type="checkbox" name="state[]" value="IA">



<input type="checkbox" name="state[]" value="MO">[/COLOR]
[/FONT]
[/QUOTE]

[FONT=courier][/FONT]

So in your case your script should loop through all the elements in the area to see if the box was checked or not.


For example:


[FONT=courier][/FONT][code=php]<?php
$state=$_POST['state'];
foreach ($state as $statename)
{
echo "$statename is checked";
}

?>[/code]



Good luck!
×

Success!

Help @jimo474 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...