[FX.php List] Problem re-submitting checkboxes to FM7

William Akey wcakey at hotmail.com
Thu May 11 15:57:23 MDT 2006


Dan (and Dale),

Ahhhh... Well, you are both right as you probably knew you were :-). As you
have surmised, at that point in the processing, $FieldName is not an array,
which I was able to determine with the trusty function that I found:

echo is_array($FieldName) ? 'Array' : 'not an Array';

It turns out that I was passing all of the posted values through a
stripslashes() filter before extracting $FieldName from the POST array.

I am deeply appreciative of all the time you guys spent helping point me in
the right direction so I could see my error and correct it. Now using
implode() on $FieldName does the trick and all is very groovy.

Best regards

William



----- Original Message ----- 
From: "DC" <dan.cynosure at dbmscan.com>
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Sent: Thursday, May 11, 2006 1:47 PM
Subject: Re: [FX.php List] Problem re-submitting checkboxes to FM7


> ok, then something is changing $FieldName before you do the print_r
> step. as Dale so keenly pointed out, you would see the actual array
> printed out.
>
> where is the $FieldName set first?
>
> there has got to be a section of code somewhere that is changing the
> real array into a string that just says "Array"
>
> more code would help.
>
> dan
>
> William Akey had written:
> > Dan,
> >
> > Using
> >
> > echo '<pre>';
> >  print_r($FieldName);
> >  echo '</pre>';
> >
> > Gives me the word: "Array" as before, but in typewriter font.
> >
> > William
> >
> > ----- Original Message ----- 
> > From: "DC" <dan.cynosure at dbmscan.com>
> > To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> > Sent: Thursday, May 11, 2006 1:29 PM
> > Subject: Re: [FX.php List] Problem re-submitting checkboxes to FM7
> >
> >
> >
> >>how bout this:
> >>
> >>echo '<pre>';
> >>print_r($FieldName);
> >>echo '</pre>';
> >>
> >>dan
> >>
> >>William Akey had written:
> >>
> >>>Dale,
> >>>
> >>>The result of print_r($FieldName); is the single word:
> >>>
> >>>Array
> >>>
> >>>Which, if I understand things correctly, is what I would expect since I
> >
> > used
> >
> >>>FieldName[] in the input tag on the preceding page. Is this not
correct?
> >>>
> >>>Thanks
> >>>
> >>>William
> >>>
> >>>
> >>>
> >>>----- Original Message ----- 
> >>>From: "Dale Bengston" <dbengston at preservationstudio.com>
> >>>To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> >>>Sent: Thursday, May 11, 2006 1:00 PM
> >>>Subject: Re: [FX.php List] Problem re-submitting checkboxes to FM7
> >>>
> >>>
> >>>
> >>>
> >>>>William,
> >>>>
> >>>>I was driving at the same thing Dan is; does $FieldName contain the
> >>>>values you think it should? I thought it might be as simple as a
> >>>>coding error. So, what do you get when you print_r($FieldName)?
> >>>>
> >>>>Dale
> >>>>
> >>>>On May 11, 2006, at 2:48 PM, William Akey wrote:
> >>>>
> >>>>
> >>>>
> >>>>>Hi Dale,
> >>>>>
> >>>>>Thanks for your response. Sorry, I figured that would be
> >>>>>understood. When I
> >>>>>said I was submitting $FieldName back to the database, I meant the
> >>>>>result of
> >>>>>using:
> >>>>>
> >>>>>$FieldName = $_POST['FieldName'];
> >>>>>
> >>>>>on the page where I am actually doing the FMEdit().
> >>>>>
> >>>>>William
> >>>>>
> >>>>>
> >>>>>----- Original Message -----
> >>>>>From: "Dale Bengston" <dbengston at preservationstudio.com>
> >>>>>To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> >>>>>Sent: Thursday, May 11, 2006 12:31 PM
> >>>>>Subject: Re: [FX.php List] Problem re-submitting checkboxes to FM7
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi William,
> >>>>>>
> >>>>>>By $FieldName do you actually mean $_POST['FieldName']?
> >>>>>>
> >>>>>>Dale
> >>>>>>
> >>>>>>On May 11, 2006, at 2:26 PM, William Akey wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>A while ago, there was some good discussion about how to properly
> >>>>>>>display a
> >>>>>>>series of checkboxes on a web page. Thanks to those discussions and
> >>>>>>>the use
> >>>>>>>of the explode() and in_array() functions I have been able to get
> >>>>>>>this
> >>>>>>>working correctly.
> >>>>>>>
> >>>>>>>What I cannot get to work correctly is the return of the edited
> >>>>>>>checkbox
> >>>>>>>data to the FM7 database. If I set up the input elements as:
> >>>>>>>
> >>>>>>><input type="checkbox" name="FieldName[]" value="nine" checked >
> >>>>>>><input type="checkbox" name="FieldName[]" value="ten" checked >
> >>>>>>>
> >>>>>>>and then use implode("\n", $FieldName) before submitting it back to
> >>>>>>>the
> >>>>>>>database with FMEdit(), I get a PHP bad argument warning for the
> >>>>>>>implode()
> >>>>>>>function and the data in FileName in the database is erased. If I
> >>>>>>>do not use
> >>>>>>>implode() before submitting $FieldName, then FieldName in the
> >>>>>>>database ends
> >>>>>>>up with the word "Array" in it and the other values are gone.
> >>>>>>>
> >>>>>>>If I use FieldName in the input tag, without the "[]", and do not
> >>>>>>>use
> >>>>>>>implode(), then only the last checked value gets submitted to the
> >>>>>>>database
> >>>>>>>and the others are deleted.
> >>>>>>>
> >>>>>>>It seems that using FieldName[] in the input tag and implode("\n",
> >>>>>>>$FieldName) in combination should work, but it doesn't. So, what am
> >>>>>>>I doing
> >>>>>>>wrong and how do I get this to work correctly??
> >>>>>>>
> >>>>>>>Thanks for any help you can offer.
> >>>>>>>
> >>>>>>>William
> >>>>>>>_______________________________________________
> >>>>>>>FX.php_List mailing list
> >>>>>>>FX.php_List at mail.iviking.org
> >>>>>>>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>>>>
> >>>>>>_______________________________________________
> >>>>>>FX.php_List mailing list
> >>>>>>FX.php_List at mail.iviking.org
> >>>>>>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>>>>
> >>>>>
> >>>>>_______________________________________________
> >>>>>FX.php_List mailing list
> >>>>>FX.php_List at mail.iviking.org
> >>>>>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>>
> >>>>_______________________________________________
> >>>>FX.php_List mailing list
> >>>>FX.php_List at mail.iviking.org
> >>>>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>>
> >>>
> >>>_______________________________________________
> >>>FX.php_List mailing list
> >>>FX.php_List at mail.iviking.org
> >>>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>>
> >>
> >>_______________________________________________
> >>FX.php_List mailing list
> >>FX.php_List at mail.iviking.org
> >>http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>


More information about the FX.php_List mailing list