Here is the confo email php im using. It works great! The only issue is for "when_should_we_expect_you this is a date component and it shows up in the confo email as "array" is there a way to have it see mmddyyyy? Im a bit lost on this one.

$to = $form['submitted']['email_address']['#value'];
$first_name = $form_values['submitted_tree']['first_name'];
$last_name = $form_values['submitted_tree']['last_name'];
$phone_number = $form_values['submitted_tree']['phone_number'];
$booking = $form_values['submitted_tree']['booking'];
$when_should_we_expect_you = $form_values['submitted_tree']['when_should_we_expect_you'];
$which_time = $form_values['submitted_tree']['which_time'];
$from = "reservations@xxxxxxxxxxxxxx.com";
$body = "Dear " . $first_name  . " " . $last_name . ", \n\n
Thank you for reserving a tour for " . $booking . " on " . $when_should_we_expect_you . " at " . $which_time . " \n
In case you don't turn up we will call you at " . $phone_number . " \n\n


Kindest regards,\n
";

$message = drupal_mail('webform_extra', 'reply', $to, language_default(), array('body' => $body), $from, TRUE);

function webform_extra_mail($key, &$message, $params) {
  $message['subject'] = "Tour Conformation from xxxxxxxxxxxx.";
  $message['body'] = $params['body'];
}

Any help appreciated!

David

Comments

quicksketch’s picture

You should be theming your e-mails as recommended in THEMING.txt rather than using the additional submit code field. Providing help with custom PHP code is outside the scope of what support is provided in the Webform issue queue.

rankinstudio’s picture

I am just following the instructions for webform found here. Im not themimg the default email, this is a "Webform Additional Submission Snippets" provided here

http://drupal.org/node/323666

Just wondering why the date wont work right.

David

djalloway’s picture

If $form_values['submitted_tree']['when_should_we_expect_you'] is indeed a Date component then it typically would show up as an array because that is how Webform stores the data for a Date component.

You have the Month, Day and Year stored in array format, so....

$month = $form_values['submitted_tree']['when_should_we_expect_you'][0];
$day = $form_values['submitted_tree']['when_should_we_expect_you'][1];
$year = $form_values['submitted_tree']['when_should_we_expect_you'][2];

// expected output display
$full_date = $month .'/'. $day .'/'. $year;
rankinstudio’s picture

djalloway,

Thank you! Im really new to php. Really appreciate it :)

Cheers,

David

madlee’s picture

thanks. I was using month day and year instead of the array numbers.

quicksketch’s picture

Status: Active » Closed (fixed)