• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP help - EMailing

PoonDaddy007

Senior member
I have a page that has variables listed on it already. And I want to have those values sent thru email to me.

Quick breakdown:

Page 1 -> User enters in various information [name, address, email, etc]. I have those values entered into text fields and have them passed to page 2 with names like $FNAME, $LNAME, $ADDRESS, etc. when the user hits submit.

Page 2 -> Echos what user inputs on page1 making sure all the entered information is correct sort of like a confirmation page before submitting again. When the user hits submit I want the values to be emailed to me.

How do I go about doing this?

Thanks.
 
Variables are passed to the second script with the name given to the form element, e.g.:

< input type="radio" name="button" >

will be passed to the script as $button (unless register_globals aren't on, then you reference it by saying $button = $_POST["button"] if using the POST method, or $button = $_GET["button"] if using GET).

Then just format the variables however you want into one variable, e.g.:

$mailthis = "The user $user said $whathesaid and can be contacted at $hisemail";

and do:

mail($youremail, "Subject goes here", $mailthis)

Might be a good idea to filter out HTML using $whathesaid = strip_tags($whathesaid) so you don't get any HTML emails with inappropriate or other such nonsense content.

Edit: Small correction to the mail() statement, forgot that you wanted the output mailed to you, not the person that submitted the information.
 
Back
Top