I can’t understand why this simple mailing php function I wrote doesn’t work. It’s installed inside a WordPress page (that’s why I used REQUEST_URI and not PHP_SELF). I’m just a php beginner, have I forgot something?
<?php
echo '<form method="post" action="';
echo $_SERVER['REQUEST_URI'];
echo '"><input type="image" name="blabla" src="/image-path/image.png"></form>';
if ($_POST['blabla'])
{
$to = 'email@emailadress.com';
$subject = 'Test mail';
$message = 'Test.';
mail($to,$subject,$message);
echo "Email sent.";
}
?>
try if(isset($_POST[‘blabla_x’]) or isset($_POST[‘blabla’]))
because, when you POST image, some browsers sends point where you pressed.