Link to home
Start Free TrialLog in
Avatar of yotsse
yotsse

asked on

Multi mail recipient

Hi,

I've the following form which content a checkbox field with 4 possible value. What I want is to send the form to a recipient depending on checkbox check : here is my code :

<form method='post' action='contact.php'>
E-mail :<input type='text' name='mail' size='20' value='$mail' maxlength='40' />
Your inquirie :
<input class='input2' type='checkbox' name='demande' value='tech'>Technique
<input class='input2' type='checkbox' name='demande' value='sav'>S.A.V.
<input class='input2' type='checkbox' name='demande' value='doc'>Documentation
<input class='input2' type='checkbox' name='demande' value='autre'>Autre

<input name='submit' type='submit' value='Send' />
</form>

--------------------


$toaddress = "technique@test.fr (if 'tech' checked)", "sav@test.fr (if 'sav' checked)", "documentation@test.fr (if 'doc' checked)", "autre@test.fr (if 'autre' checked)";
$subject = "contact";
$mailcontent =
              ."e-mail: ".$email."\n"
              ."Demnande 1: ".$tech."\n"
              ."Demande 2: ".$sav."\n"
              ."Demande 3: ".$doc."\n"
              ."Demande 4: ".$autre."\n"
              ."Message: ".$message."\n";

mail($toaddress, $subject, $mailcontent);


echo "Votre message has been sent


--------------

Does anyone can help

Thanks in advance
   
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Re: Diable84. You know that with javascript run from your favourites you could change the values of the checkboxes and change them into 'all' or something, quite easily spamming the whole company?

two cts.

-r-
Avatar of Diablo84
Diablo84

You could achieve the same thing by creating another form and submitting it to the processing page, just a bare bones example to add to the mix... demonstrating how important validation is ;)