Home
Support Forums

Success form not working

For some reason, my Netlify form is continuing to display the standard 'Thank you" Netlify success message after submission. I believe I am following the steps perfectly, action set to the page which I want to display in the same folder but it just isn’t working. I tried setting action=“mail.php”, “/mail”, “mail”…nothing works. It is supposed to be a mail.php file correct?

Here is my form “contact.html” (website link https://hjedbksdf.tk/contact)

<!DOCTYPE html>

<form action="/mail" method="post" data-netlify-recaptcha="true" data-netlify="true">
    <label for="yourname">Name<span style="color:red;">*</span></label>
    <input type="text" id="yourname" name="yourname" placeholder="Your name.." required>
    <label for="email">Email</label><br>
    <input type="email" id="email" name="email" placeholder="Email address.."><br><br>
    <label for="country">Country</label>
    <select id="country" name="country">
      <option value="CA">Canada</option>  
    </select>
    <label for="comments">Message<span style="color:red;">*</span></label>
    <textarea id="comments" name="comments" placeholder="Message.." style="height:170px" required></textarea>
	<div class="g-recaptcha" data-sitekey="6LffYqcZAAAAANjgeAwFlNBVC-cdj3_khFLg6VDr" data-callback="enableBtn"></div>
	<button type='submit' class="button" id='button1'>Send</button>
  </form>
</div>
`

My mail.php is in the same folder:
<html>
<body>
Your name is: <?php echo $_POST['yourname']; ?>
Your e-mail: <?php echo $_POST['email']; ?>
Comments:<?php echo $_POST['comments']; ?>
</body>
</html>

You can test it at https://hjedbksdf.tk/contact.
Any help is appreciated.

hi there,

it’s not possible to run php the way you are hoping to on netlify.

Here is a good summary of what you can and can not do on Netlify you might find helpful:

Hi @perry perry , thank you for your answer.
Can I ask what is you advice on how to make a success message on form entry? Must it be a .html file? I am very new so the support guide is confusing to me.
Thank you and best,
-Nikolai.

hi nikolai,

did you see the documentation on this? this is the best place to start:

hi @perry, yes i saw that documentation but I am still confused, it seems like I am following the steps. Is it because I cannot set action= a php file? Thank you and please bear with my noviceness!

yes, that is correct. you cannot use php on Netlify.