Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!