Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda