Developer Support »

FormToEmail returning value 'Array'  (See more user questions)

Hi .

Thank you for your purchase, good to hear from you.

Are you trying to pre-populate the form? That's what your code looks like,
or are you getting "Array" in the resultant email when submitting your form?

Probably the easiest thing to do would be to give the drop-down a non-array
name like "abilityLevel" (without the square brackets):

<select name="abilityLevel" size="1">

It's the square brackets that makes it an array and is used if there is more
than one value for an input (checkboxes for example) but isn't needed here.

Otherwise you will have to code every option, like this (coding shown for
your first option):

<option value="1" <?php if(isset($abilityLevel) &&
in_array("1",$abilityLevel)){print "selected=\"selected\"";} ?>>1</option>

...changing the "1" to the appropriate value for each option.

This code is available on the support page for pre-populating the form, it
is shown under the checkboxes section:

https://formtoemail.com/developersupport/pre_populate_form.php

That should do you.

Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Friday, January 07, 2011 7:47 AM
Subject: FormtoEmail returning value "Array"


> Hi Charles,
>
> I'm having an issue with the form sending "Array" as the value for my drop
> down lists. Do you have any documentation on this?
>
> below is the copy of the code from html:
>
> <td><select name="abilityLevel[]" size="1">
> <option><?php if(isset($abilityLevel)){print
> stripslashes($abilityLevel);}else{print "";} ?></option>
> <option value="1">1</option>
> <option value="1+">1+</option>
> <option value="2">2+</option>
> <option value="3">3</option>
> <option value="3+">3+</option>
> <option value="4">4</option>
> <option value="4+">4+</option>
> <option value="5">5</option>
> <option value="Advanced">Advanced</option>
> </select></td>
>
> Thanks for your help.