I want to send an email with PHP when a user has finished filling in an HTML form and then emailing information from the form. I want to do it from the same script that disp
If I understand correctly, you wish to have everything in one page and execute it from the same page.
You can use the following code to send mail from a single page, for example index.php
or contact.php
The only difference between this one and my original answer is the where the action has been left blank.
It is better to use header('Location: thank_you.php');
instead of echo
in the PHP handler to redirect the user to another page afterwards.
Form submission