PDA

View Full Version : Form data not correct when sent via email.


Jason Kline
09-30-2009, 10:55 PM
https://klineitsolutions.com/sendform/sendreq.php

Appointment Information shows up in email like this:

Consultation Request Form Appointment Information Best day: 10/15/2009

Consultation Request Form Appointment Information Best times: Array

Consultation Request Form group Confirm by: Array

I am not sure why.

Eric Mittman
10-01-2009, 12:22 PM
It looks like you are just sending the looped over posted values in the message. This is one way to get a forms information sent but as you can see it does not always give you the desired result. The problem with the values that are showing up as arrays is because only the name of the variable was referenced and not a subscript of the array.

For the 'best times' this is a multi select list on your page so the information will be contained in an array, the same goes for the checkboxes for confirm by.

To get around this you can use the php implode function on the array to get the values into a single string. Here is a link to the function page:

php.net/implode

If the script that is doing the mailing is not one that you have any access to for editing I would suggest that you try a different approach for sending the info. The Universal Email tool that we offer will allow you to craft the message in DW and use the bindings like you would normally use. You can then update the code to implode the array or loop over it and print the values out one at a time. Another function that would list the contents of the array is var_dump(), but it is not very clean looking and is normally used for debugging purposes.

Jason Kline
10-02-2009, 06:23 PM
Thank you Eric...

I used this code below and it's working:

echo $a = implode(",", $Consultation_Request_Form_Appointment_Information _Best_times)
echo $a = implode(",", $Consultation_Request_Form_group_Confirm_by)

Eric Mittman
10-05-2009, 02:32 PM
Sounds like you were able to edit the mailing script that was being used. That is great to hear that you got it worked out, using arrays in PHP gives you alot of power and flexibility. Knowing how to manipulate these arrays lets you do some neat stuff.

rob294118
08-15-2010, 05:26 PM
I have a couple list items where I use IMPLODE and it works fine.

I try to create another list field on my form and the form tells me the list does not support multiple list items. The implode statement does NOT work on this new field.

$MailBody = $MailBody . ((isset($_POST["Appointment_request_group_Type_of_event[]"]))?implode(", ", $_POST["Appointment_request_group_Type_of_event[]"]):"");


This program has been nothing but a headache.

Jason Byrnes
08-16-2010, 10:50 AM
this question was answered in the following thread:
http://www.webassist.com/forums/showthread.php?p=71296