The first code without $_Post works, the second one with $_POST doesnt. It is on the server in cpanel. Anything helps :)
I tried various things like changing the code in HTML, placing slashes, also using $_request over $_post.
This works -
$to_email = "example@example.hr";
$subject = "Simple Email Test via PHP";
$body = "Hi,nn This is test email send by PHP Script";
$headers = "From: me@example.hr";
if ( mail($to_email, $subject, $body, $headers)){
echo("Email successfully sent to $to_email...");
} else {
echo("Email sending failed...");
}
$to_email = "example@example.hr";
$subject = "Simple Email Test via PHP";
$body = "Poruka:$_POST[poruka]";
$headers = "From: $_POST[email]
";
if ( mail($to_email, $subject, $body, $headers)){
echo("Email successfully sent to $to_email...");
} else {
echo("Email sending failed...");
}
</code></pre>
The first code sends the email, while the second one goes into echo ("Email sending failed...")