0

I'm trying to send multiple selections from a safecracker form to a PHP postprocess template which will eventually send emails to the emails selected on the form. This is my code;

<select name="notified[]" id="notified" multiple="multiple">
                            <option value="">None</option>
                            <option value="email@example.com">Communications</option>
                            <option value="email2@example.com">Newsletters</option>
                            <option value="email3@example.com">Research</option>
                            <option value="email4@example.com">Corporate Services</option>
                        </select>

When I add in the [] after notified in name="notified" and then try to echo out the response in my postprocess form it throws up a PHP database error Error Number: 1054 Unknown column 'Array' in 'field list'. If I remove the [] I don't get the error but obviously it just shows me one of the values, even if I select more than one.

I'm not sure why the [] aren't working?

Any help would be very much appreciated. Thanks, Julie

EDIT: When I change notified[] to something[] the PHP error goes. But now I can't work out how to echo out the selected values on my postprocess page...

0
1

This isn't a EECMS related problem.

The error "Unknown column 'Array'" occurs because if you append a "[]" to the name of the field its value is gonna be always an array.

You need to deal with this variable on you PHP template.

I'm just guessing, but maybe this could help you:

$_POST['notified'] = implode(",", $_POST['notified']);

If you update your question and show the PHP code, we can help you better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.