Forum Moderators: coopster
Thanx in advance for n e reply,
Cheers
>> When the form is submited it should send the mail to the selected address.
do you get errors? or what is happening specifically? nothing?
did you add this drop down box yourself? You don't need to paste all the code but maybe the part that you added to deal with the new drop down.
No the form works perfectly wen it is send to one email adress i just want to modify the script and i hav no idea how to do that. Yea i added the drop down its a simple html dropdown in the html page, here's the code;
<td align="left"><select name="to" id="to">
<option value="One" selected="selected">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select></td>
i just dont know how to edit 'Jack's Formmail.php' to work with it..
Thanx
Cheers
you will need to look at the function call for the mail function
look at the variable it uses for the first parameter
find where that vaiable is set in the code
then make sure your drop down value is being pushed into that variable
you will need to add a little error checking to make sure no one passes bad values
I would suggest using an integer for the values and having the actual addresses in the formmail script, something like this
<td align="left"><select name="to" id="to">
<option value="1" selected="selected">first person</option>
<option value="2">second person</option>
<option value="3">third person</option>
</select></td>
then in the formmail script
switch ($_POST['to']) {
case 1:
$to = 'address1@example.com';
break;
case 2:
$to = 'address2@example.com';
break;
case 3:
$to = 'address3@example.com';
break;
default:
$to = false;
break;
}
if (!$to) {
echo 'you selected a bad value, shame on you';
die();
} obviously the last bit is not proper error handling but I don't know how yours is done. You could then use the variable $to in your mail function call.