Ok, I imagine this is pretty simple but I've tried everything I know and can't figure it out.
This is currently working fine: ("first" and "last" are the names of the fields on the form for First Name and Last Name)
<?php
$from = $_REQUEST['email'] ;
$fields = array();
$fields{"first"} = "First Name";
$fields{"last"} = "Last Name";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
mail( "info@mywebsite.com", "New Reservation",
$body, "From: $from" );
header( "Location: confirm.php" );
?>
What I want to be able to do is have a form with a field for First and Last name, then have the email send like:
Name: FIRST LAST
instead of
First Name: FIRST
Last Name: LAST
I've tried this :
$fields = array();
$fields{"first";"last"} = "Name";
AND
$fields = array();
$fields{"first"};{"last"} = "Name";
Niether are working... please help! Thanks 🙂