Jump to content

Mail Form


mhnd

Recommended Posts

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 = '[email protected]';
}elseif ($_REQUEST['sendto']=='c') {
$MyEmail = '[email protected]';
}elseif ($_REQUEST['sendto']=='n') {
 $MyEmail = '[email protected]';
}

 

.

.

.

.

 

 

	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

Link to comment
https://forums.phpfreaks.com/topic/272948-mail-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.