Hi Guys
i am struggling since morning with this silly piece of code, can anybody tell me what i am doing wrong
i need my script to send the email according to value chosen on html form
html code:
.
.
<select name="sendto">
<option value="b" selected>Charlene & Natalie</option>
<option value="c">Charlene Only</option>
<option value="n">Natalie Only</option>
</select>
.
.
.
php code
if ($_REQUEST['sendto']=='b') {
$MyEmail = 'b@email.co.uk';
}elseif ($_REQUEST['sendto']=='c') {
$MyEmail = 'c@email.co.uk';
}elseif ($_REQUEST['sendto']=='n') {
$MyEmail = 'n@email.co.uk';
}
.
.
.
.
if (mail($MyEmail, $subject, $body, $headers)) {
echo "success";
}else{
echo "Error : Faild to send email";
}
NOTE: the form works perfectly if i assign a value to $MyEmail without the if condition
any suggestions