Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Processing data from an Html form

I have created an html form in an html file.

<form action='index.html' method='post' id='contact_form'>
  <!-- A regular html form -->
  <input type='submit' id='send_message' class="button" value='Submit' />
</form>

The information then goes to a js file

$.post("send_comment.php",
  $("#contact_form").serialize(),
  function(result) { //Sends success or fail message back to the form
    ...
})

And should then be forwarded onwards to send_comment.php

if(mail($email_to,"A comment from" + $name,$message)){
    echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent..
}else{
    echo 'failed';
}

But, I don't get an email, even though mail() works on the server (I tried it). I am also not sure if the php even gets executed, since I tried adding a command to write "success" on a separate file just to test if the function works, but that never worked (It might be that I simply misprogrammed the test, but I don't think so).

Could somebody tell me what I did wrong?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda