answersLogoWhite

0

How can you send PHP form results to an email?

Updated: 8/16/2019
User Avatar

Wiki User

16y ago

Best Answer

Yes! This is actually pretty easy.

Here's a sample PHP script that would read the form data. If the form data was submitted, it will email it to you, otherwise, it will display the form.

Make sure your form is submitted via POST for this script. If you submit it via GET, change all the _POST to _GET.

if(isset($_POST)) //This checks if the form was submitted or not.

{

$field1 = $_POST['field_name'];

$field2 = $_POST['field_name2'];

$body = "Form field 1: $_POST['field_name']
Form field 2: $_POST['field_name2']";

mail("your_email@whatever.com", "Subject", $body);

echo("Submitted!");

}else{

?>

Your form goes here.

}

?>

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you send PHP form results to an email?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you get an htmljavascript form to send the results to an email address when the submit button is pressed?

JavaScript (Nor HTML, at that) cannot send e-mails directly. You must use a more dynamic language, such as PHP or ASP.


How can you make a PHP form in HTML and submit without using a php file or email?

To submit a file, you don't even need a PHP file. The PHP portion is for processing the form results. You just make a button and make sure you defined the action URL.Name: Gender:Boy: Girl:


Is it able to send recurring eMail with PHP code such as sending an eMail every month automatically with PHP code?

By making use of Linux's cron jobs, you could schedule a PHP job to be run monthly using this line of code at the bottom of the file opened by running crontab -e:0 0 1 * * /usr/local/bin/php /path/to/php/file.phpIn that PHP file you could have your code to send an email like so:


In PHP how to send data to email?

mail($to, $subject, $message, $headers); $headers is optional.


What is the most widely use email form script?

p


How do you add HTML5 Geolocation results to a PHP form?

There is no such thing as a PHP form. Forms are written in HTML or other client side scripting languages.


Is there any widget that can take details and email them?

I dont know about widget but using php you can create a form that will then email it to you. I would suggest you try a tutorial on http://www.tutorialized.com under php.


Code for mobile alert in PHP?

You can use an email to SMS gateway to send SMS messages from a PHP script. This will likely be a paid for service, there used to be some network specific free services, but I think most of them are now closed, presumably due to abuse from spammers. Search for "email to SMS gateway". To send e-mail from PHP see the 'mail' command.


Code keeps appearing after hitting submit on the form to email in PHP are there any suggestions?

There must be an error in the PHP script. Your have to check it to see what's wrong.


How do you create an area of a webpage to display PHP results?

PHP code blocks start with <?php and end with ?>.


The post method used to send data from HTML to php is not working.?

good guess is you have one of the following errors/mistakes/bugs:you try to send a file but have no "multipart/form-data" in your form-tagyou are trying to send to a php file which is not there or you can't accessmaybe you have misnamed some fields in your form or trying to access the wrong variablesyou are mixing POST and GETjust to name a few


What is php 5.1 software?

That's PHP Engine.. Allow you to develop PHP Scripts.. you can use it to develop PHP Scripts and test it on your local machine before you send it to server.. (your website)