Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6006855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:35:58+00:00 2026-05-23T01:35:58+00:00

Im trying to setup a basic PHP contact form and despite my best efforts

  • 0

Im trying to setup a basic PHP contact form and despite my best efforts I can’t seem to make it work:

on contact.php my code looks like this:

include_once('form_record.php');
$obj = new formRECORD(); 
if ( $_POST )
     $obj->send_mail($_POST);
echo $obj->display_form();

And then form_record.php looks like this:

class formRECORD {

    public function display_form() {
    $entry_display .= <<<ENTRY_DISPLAY
               <form >
               <label>Name</label><br/>
               <input id="form_name"><br/>
               <label>Email</label><br/>
               <input id="form_email"><br/>
               <label>Phone:</label><br/>
               <input id="form_phone"><br/>
               <label>Name</label><br/>
               <textarea id="body"></textarea><br/>
               <input type="submit" value="Send" />
               </form>
ENTRY_DISPLAY;

  return $entry_display;

}
    public function send_mail($p) {
        $to = "example@gmail.com"; 
        $subject = "Contact Us"; 
        $email = $_POST['form_email'] ; 
        $message = $_POST['body'] ; 
        $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; 
        if($sent) {return "Your mail was sent successfully"; } else {return "We encountered an error sending your mail"; }
    }

}

The contact form shows up OK and there aren’t any php errors when the user hits submit. However the email never appears in my inbox. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:35:59+00:00Added an answer on May 23, 2026 at 1:35 am

    You have to set the name-attributes of the form-fields, otherwise the fields cannot be submitted. The IDs have no meaning for PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to setup a very basic jQuery image gallery. You can see my
I am trying to setup a repository at my work for all the code
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I am trying to implement performance testing on ActiveMQ, so have setup a basic
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows
I know this is a basic PHP question, and I'm trying to learn the
I am trying to set up a basic Facebook application using PHP and an
I'm learning more about PHP/Javascript, trying to set up a basic website. I've got
I am trying to setup a basic error checking system where it will catch
I'm trying to make a basic (Mario style) game but my sprite(plumber) doesn't appear,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.