Developer Support »

Writing blank checkbox values to a CSV file  (See more user questions)

My pleasure, !

I was thinking off the top of my head earlier. If it's working sweetly with $field_order_keys that's probably the best option!

Yes, I will just quote the entire email for the support section.

Best wishes.

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

On 12/04/2011 23:17, wrote:
> My guess is that since the checkbox name is in $field_order_keys = array that is how the script knows to add the comma to the CSV file. Adding the extra code you suggested is probably best, and since I still have the notepad file I can delete the "no" from each line and use it.
>
> I just proofread my previous letter, if you do use it in the Support section, please change "I looked at the script and I had actually copied and pasted only the first half of the "no" lines from the notepad file" to "I looked at the script and I had actually copied and pasted only the last half of the "no" lines from the notepad file". That's what actually happened, and since I'm describing the first half being blank, would make more sense to the reader.
>
> Had some serious fun making everything work. Thanks again!

----Original Message----- From:
> FormToEmail.com Sent: Tue 4/12/2011 4:16
> Subject: Re: FormToEmail script (CSV File)

> good information! Yes, I will add it to the previously asked questions
> in the support section.

You would be right to think that
> $show_blank_fields would show blank checkboxes but because an unchecked
> checkbox doesn't get sent to the script, the script knows nothing about
> them.

I suppose a more accurate name would be
> $show_submitted_blank_fields! I'm really pleased you figured it out! I'm
> not sure how you got your blank value sent, as opposed to "no", but you
> could do this:
> if(!isset($_REQUEST['checkbox_name'])){$_REQUEST['checkbox_name'] = "";}
> Any questions, just let me know. Best wishes. Charles Sweeney
> https://formtoemail.com The world's easiest feedback script! On
> 12/04/2011 19:46, wrote:
>> > Update: I found the previously asked question (and a duplicate shorter
>> > one) on returning values for unchecked checkboxes in the "Support"
>> > section. You suggested to enter:
>> >
>> > if(!isset($_REQUEST['checkbox_name'])){$_REQUEST['checkbox_name'] =
>> > "no";}
>> >
>> > for each checkbox, in the script after the instructions, and above:
>> >
>> > $errors = array();
>> > $attachment_array = array();
>> >
>> > And that would have the script enter a value of "no". You also said if
>> > there were problems to enable the $sort_fields option and specifically
>> > state the order of the fields to be dealt with in Form Fields Order,
>> > $field_order_keys = array.
>> >
>> >
>> > So I created all my "no" lines in a separate notepad file to copy and
>> > paste it into the script. Did the copy/paste, saved and uploaded.
>> > Submitted a test form, and to my surprise, the first half of the
>> > checkbox data was blank (unless checked), the second half had "no" in
>> > them (unless checked). I looked at the script and I had actually copied
>> > and pasted only the first half of the "no" lines from the notepad file.
>> >
>> > The result is that as long as $sort_fields is enabled and the checkbox
>> > names are listed in $field_order_keys = array, the script will put the
>> > "yes" for a checked box or nothing for an unchecked box in the CSV file
>> > (the previous person wanted a "no", but I'm happy having nothing as long
>> > as the field is recognized and the import order intact).
>> >
>> > What's confusing to the untrained is one would expect that
>> > $show_blank_fields = 1; would, uhh, show the blank fields for checkboxes
>> > in the CSV file. But I guess it doesn't.
>> >
>> > Thought you might want to consider this for your Support information.
>> >
>> > Thanks again!