Forum Moderators: coopster
I need to rig it to where if certain checkboxes are checked it will go to certain e-mails
===========
Ie: If "checkbox 1" is checked form info will go to
"abc1@domain.com"
If "checkbox 2" is checked form info will go to
"xyz1@domain.com"
If both of them are checked, it will send form info to both addresses.
==========
This is very urgent, i could really use your help
Particularly: ht*p://www.hotscripts.com/cgi-bin/search.cgi?bool=AND&query=mail+form&catid=all
You might be able to get a quick freebie from there.
Hopefully someone with more knowledge will be along shortly to help you further.
Best of luck! :)
In your mail() function, you have a part for your recipients.
If you set this as a variable, ie: $recipients before calling the mail function, then you can do the following:
$recipients = "alwaysreceive@domain.com";
if($checkbox1 == 1) {
$recipients .= "; abc@xyz.com";
}
if($checkbox2 == 1) {
$recipients .= "; cde@vwy.com";
}
Then call the mail function, and in the header section for recipient, just put $recipients
I'm not too sure whether the ; before the email address will work, if not, just have a play around, but I think this is the general idea ;)
wruk999
<TABLE BORDER=0 cellpadding=0 cellspacing=0><TR><TD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide code from non-js browsers
function validate()
{
formObj = document.contact;
if ((formObj.name.value == "") ¦¦
(formObj.email.value == "") ¦¦
(formObj.subject.value == "") ¦¦
(formObj.msg.value == ""))
{
alert("You have not filled in all required fields.");
return false;
}
else
return true;
}
// end hiding -->
</SCRIPT>
<TABLE BORDER=0 cellpadding=0 cellspacing=0><form action=contact.php method=post name=contact onSubmit="return validate()">
<TR><TD>
<DIV>
1. Name<BR>
<input type=text value='your name' size=50 maxlength=50 name=name class='txtfield'><BR>
<BR>
2. Email Address <BR>
<input type='text' size='50' maxlength='60' name='email'><BR>
<BR>
3. Phone Number<BR>
<input type='text' size='50' maxlength='32' name='phone'><BR>
<BR>
<BR>
4. Club(s) you wish to join.
{{checkboxes would go here}}
<input type='submit' value='Submit'><BR>
</TD></tR></FORM></tABLE>
---------------------------------------------------------
<?
include('header.php');
if ($REQUEST_METHOD == "POST") {
$adminemail = "clubemail@domain.com";
$msg2 = "
Name: $name
Email: $email
Phone: $phone
Message:$msg
";
mail("$adminemail", "Club Name: $subject", "$msg2", "From: $email \nReply-To: $email");
echo " Thank you! Please press the 'back" button on the browser!";
} else {
include('contactform.php');
}
?>
</TD></TR></tABLE>
----------------------------------
this help any?>?
$adminemail = "clubemail@domain.com";
if($checkbox1 == 1) {
$adminemail .= "; abc@xyz.com";
}
if($checkbox2 == 1) {
$adminemail .= "; cde@vwy.com";
}$msg2 = "
Name: $name
Email: $email
Phone: $phone
Message:$msg
";mail("$adminemail", "Club Name: $subject", "$msg2", "From: $email \nReply-To: $email");
echo " Thank you! Please press the 'back" button on the browser!";
wruk999.
include('header.php');
if ($REQUEST_METHOD == "POST") {
$adminemail = "-------------@yahoo.com";
$msg2 = "
Name: $name
Email: $email
Phone: $phone
Message:$msg";
mail("$adminemail", "Club Registration: $subject", "$msg2", "From: $email \nReply-To: $email");
echo " Thank you! Please press the 'back" button on the browser!";
} else {
{
if($checkbox1 == 1) {
$adminemail = "------------@yahoo.com";
}
if($checkbox2 == 1) {
$adminemail = "------------@comcast.com";
}
{
if($checkbox3 == 1) {
$adminemail = "------------y@hotmail.com";
}
if($checkbox4 == 1) {
$adminemail = "bl------------@hotmail.com";
}
{
if($checkbox5 == 1) {
$adminemail = "j------------17@unt.edu";
}
if($checkbox6 == 1) {
$adminemail = "i------------l_------------s@hotmail.com";
}
{
if($checkbox7 == 1) {
$adminemail = "LL------------e@ev1.net";
}
if($checkbox8 == 1) {
$adminemail = "h------------_luke@yahoo.com";
}
{
if($checkbox9 == 1) {
$adminemail = "f------------4@unt.edu";
}
if($checkbox10 == 1) {
$adminemail = "a------------@unt.edu";
}
{
if($checkbox11 == 1) {
$adminemail = "------------@attbi.com";
}
if($checkbox12 == 1) {
$adminemail = "libe------------e@hotmail.com";
}
{
if($checkbox13 == 1) {
$adminemail = "r.h------------@verizon.net";
}
if($checkbox13 == 1) {
$adminemail = "ro------------1@hotmail.com";
}
{
if($checkbox13 == 1) {
$adminemail = "sa------------86@yahoo.com";
}
if($checkbox14 == 1) {
$adminemail = "d------------ux@yahoo.com";
}
{
if($checkbox15 == 1) {
$adminemail = "z------------@tams.sch.unt.edu";
}
if($checkbox16 == 1) {
$adminemail = "maggie2704@aol.com";
}
{
if($checkbox17 == 1) {
$adminemail = "A------------@adsfds.com";
}
if($checkbox18 == 1) {
$adminemail = "s------------01@unt.edu";
}
{
if($checkbox19 == 1) {
$adminemail = "je------------a@yahoo.com";
}
if($checkbox20 == 1) {
$adminemail = "b------------@hotmail.com";
}
{
include('contactform.php');
}
?>
It doesnt work... why?
here is the contactform.php
--------
<!-- Hide code from non-js browsers function validate() { formObj = document.contact; if ((formObj.name.value == "") ¦¦ (formObj.email.value == "") ¦¦ (formObj.subject.value == "") ¦¦ (formObj.msg.value == "")) { alert("You have not filled in all required fields."); return false; } else return true; } // end hiding -->?
[then my actual form is down here with all the checkboxes and stuff]