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

  • SEARCH
  • Home
  • 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 8018633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:10:27+00:00 2026-06-04T21:10:27+00:00

How do I send an email to the user with the data they submitted

  • 0

How do I send an email to the user with the data they submitted in the form that includes a little message using there name and thanking them on submit of php form.

Here is my current php code. It currently just shows them a message that says there name and that the message has been sent and then sends me an email to my email address.

<?php
    if(isset($_POST['submit'])){

        $to = "benlevygraphics@gmail.com";
        $headers = "From: " . $_POST['email'];
        $subject = "Ben, you have been contacted...";
        $body = "Name: " . $_POST['name'] . "\nEmail: " . $_POST['email'] . "\nWebsite: " . $_POST['web'] . "\nMessage: " . $_POST['message'];

        if(mail($to, $subject, $body, $headers)){

        echo("<p class=contactformsent>".$_POST['name'].", your message has been sent!</p>");

        }
        else{
           echo("<p class=contactformnotsent>".$_POST['name'].", Message delivery failed...</p>");
        }
   }
?>

I am new to php and I have read stuff online and I still don’t understand so if you could be clear in your examples or help I would greatly appreciate it very much. Thanks!

  • 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-06-04T21:10:28+00:00Added an answer on June 4, 2026 at 9:10 pm

    Assuming your current code is already working fine, you can do this to send yourself an email together with the recipient:

    1. Set $to to $_POST['email']
    2. Set $headers to "From: {$_POST['email']}\r\nBcc: benlevygraphics@gmail.com"
    3. Adjust $body and $subject to your needs.

    Btw, I can’t say this often enough; make sure that your page has some form of CSRF protection.

    How to properly add CSRF token using PHP

    The above is just one way, there are others, just search for it 🙂

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

Sidebar

Related Questions

is there any way that when i user send an email to admin@xx.com the
I'm developing an ASP.NET MVC application that will send the user a confirmation email.
I've got a form that allows the user to edit an employees information: name,
i want to send an email to user after he sign-up with code.for ex
I need to send email notifications to either a group or user on every
When a button is clicked, the end user is able to send an email.
I send email through Outlook using VB.Net 2005; this is working fine. At the
I am trying to send email using Exchange 2007 from a console app using
I have an ASP.Net form and I want to send an email when the
I am using a third party shopping cart that sends a registration form to

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.