close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Missing field in generated email

Thread began 8/27/2012 6:40 pm by Martin | Last modified 8/28/2012 11:27 am by Martin | 391 views | 4 replies |

Martin

Missing field in generated email

Hi Guys,

Hopefully a simple question that I know I have asked before.

I have a select list in a form. It only lets you select one item. As such I would think that if I want to input the info into the generated email it would look like this.

<?php echo((isset($_POST["reason[]"]))?$_POST["reason[]"]:"") ?>

I realize I have to remove the [] which I have done. But the email is not pulling the selected form field.

Any ideas?

Thanks,
Martin

Sign in to reply to this post

Jason ByrnesWebAssist

using [] at the end of the name means that the select list is set to be a multiple select list.

a multiple select list passes the selections as an array.

in the email message remove the [] from the binding code, and add the following code at line 1 of the page to convert the array to a comma separated list:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

Martin

Hi Jason,

Thanks, I have taken the code and uploaded it. I have tried the form and all its spits out in the final file is "array".

I am uploading the files for you too have a look at.

Thanks!
Martin

Attached Files
contact.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code was supposed to go on the form page, not the email template page.

Sign in to reply to this post

Martin

Thank you! That worked.

LOL! I think I should add a tag line to my profile - "I never claimed to be a coder!"

Cheers,
martin

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...