hey so i have have the following php code to go with a html form. how to i make it so if the php worked, it would respont “it Worked!”?
<?php $ToEmail = '[email protected]'; $EmailSubject = 'Newsletter Subscription'; $mailheader = "From: ".$_POST["emailN"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["emailN"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$_POST["nameN"].""; $MESSAGE_BODY .= "Email: ".$_POST["emailN"].""; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?>Just use the IF statement.
[php]<?php
$ToEmail = '[email protected]';
$EmailSubject = 'Newsletter Subscription';
$mailheader = "From: ".$_POST["emailN"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["emailN"]."\r\n";
$mailheader .= "Content-type: text/html;
charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["nameN"]."";
$MESSAGE_BODY .= "Email: ".$_POST["emailN"]."";
if (mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader)) {
echo "Email Sent Successfully, Thanks for your response";
} else {
echo "Sorry Email Not Sent, Please try again!"
}
?>[/php]