I have a function which is supposed to be called onClick but every time I go to that page it gets called(sending and email). I have no idea why. I am attaching the function syntax and the syntax for the button it is supposed to get called from. Please help.
function sendMail($to, $subject, $message, $headers) {
// Send the message
$ok = @mail($to, $subject, $message, $headers);
echo "calling mail function";
if ($ok) {
return "OK";
} else {
return "Mail could not be sent. Sorry!";
}
}
<INPUT TYPE="button" VALUE="Submit" onClick="<?sendMail($mailer_to, $mailer_subject, $msg, $headers);?>)"></td>