[FX.php List] 2 value Lisus together help
William Downs
william.downs at gmail.com
Fri Oct 12 12:31:54 MDT 2007
Steve,
sorry, had my closing tag in the wrong place -
many thanks for all your help - it's working geat now
William
On 10/12/07, William Downs <william.downs at gmail.com> wrote:
> Here is what it is showing on the receiving page.
>
> [vlLanguages] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => )
>
> dross, :-)
>
> William
>
> On 10/12/07, William Downs <william.downs at gmail.com> wrote:
> > Actually, No, it does not populate the array when it's posted, only
> > contain numbers (although it does have the correct amount of numbers.
> >
> > Here is my code now. I have the brackets in as you said. :
> >
> > Cheers
> >
> > foreach($LangAllResult['data'] as $key=>$LangAllData){
> >
> > $langRecid = $LangAllData[recid][0];
> > $vlLanguage = $LangAllData[Language][0];
> >
> > if(in_array($vlLanguage,$medLanguages)) {
> > ?>
> >
> > <input type="checkbox" name="vlLanguage[]" checked="checked"
> > value="<?php $vlLanguage ?>" /><?php echo $vlLanguage ?>;
> > <?php
> > } else {
> >
> > ?>
> > <input type="checkbox" name="vlLanguage[]" value="<?php $vlLanguage
> > ?>" /><?php echo $vlLanguage ?>;
> > <?php
> > }
> > }
> > ?>
> >
> >
> >
> > On 10/12/07, Steve Winter <steve at bluecrocodile.co.nz> wrote:
> > > Does that mean it's working all the way through...?
> > >
> > > Cheers
> > > Steve
> > >
> > > -----Original Message-----
> > > From: fx.php_list-bounces at mail.iviking.org
> > > [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of William Downs
> > > Sent: Friday, 12 October 2007 6:32 p.m.
> > > To: FX.php Discussion List
> > > Subject: Re: [FX.php List] 2 value Lists together help
> > >
> > > Hey Steve, your a great guy and help etc
> > >
> > > Many thanks -
> > >
> > > William
> > >
> > > On 10/12/07, Steve Winter <steve at bluecrocodile.co.nz> wrote:
> > > > Hi William,
> > > >
> > > > Nope, that was the second part of my previous message, this will be easier
> > > > of your checkboxes all have the same name, but add [] after the name. That
> > > > way they are already in an array when they get posted back... and that way
> > > > the second part of my explanation will work...
> > > >
> > > > Cheers
> > > > Steve
> > > >
> > > > -----Original Message-----
> > > > From: fx.php_list-bounces at mail.iviking.org
> > > > [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of William Downs
> > > > Sent: Friday, 12 October 2007 6:16 p.m.
> > > > To: FX.php Discussion List
> > > > Subject: Re: [FX.php List] 2 value Lists together help
> > > >
> > > > I was posting at the same time as yourself Steve ;-0
> > > >
> > > > I now just need to post the multiple values and I can take it from
> > > > there ! I suppose I need to name each checked box with a unique name
> > > > for that to happen ?
> > > >
> > > > William
> > > >
> > > > On 10/12/07, Steve Winter <steve at bluecrocodile.co.nz> wrote:
> > > > > William,
> > > > >
> > > > > With the bit that doesn't work;
> > > > >
> > > > > if(in_array($LangAllData,$medLanguages)) {
> > > > > echo 'checked=\"checked\" '; //this DOES NOT WORK
> > > > > }
> > > > >
> > > > > Try this instead;
> > > > >
> > > > > if(in_array($vlLanguage,$medLanguages)) {
> > > > > echo 'checked=\"checked\" ';
> > > > > }
> > > > >
> > > > > And in the previous line, which does work, you'll need to have;
> > > > > echo '<input type="checkbox" name="vlLanguage[]"
> > > value="'
> > > > .
> > > > > $vlLanguage . '">'; //this works fine
> > > > >
> > > > > Note the addition of [] after vlLanguage, so that the items get added to
> > > > an
> > > > > array to be posted back...
> > > > >
> > > > > Let me know how you get on...
> > > > >
> > > > > Cheers
> > > > > Steve
> > > > >
> > > > > -----Original Message-----
> > > > > From: fx.php_list-bounces at mail.iviking.org
> > > > > [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of William Downs
> > > > > Sent: Friday, 12 October 2007 5:48 p.m.
> > > > > To: FX.php Discussion List
> > > > > Subject: Re: [FX.php List] 2 value Lists together help
> > > > >
> > > > > Hi there Steve,
> > > > >
> > > > > many thanks for the help - i am still stuck on the first part :-(
> > > > >
> > > > > I had to ask the boss something, and it turned out that HE had got the
> > > > > requirements SLIGHTLY wrong, so I tried the following (it was not the
> > > > > areas but the languages) - it still does not show thau checked box -
> > > > > code =
> > > > >
> > > > > <?php
> > > > > //first query for only languages spoken
> > > > > $groupSize ='All';
> > > > > $medLang=new FX($serverIP,$webCompanionPort,'FMPro7');
> > > > > $medLang->SetDBData($fmFile,'medLanguages',$groupSize);
> > > > > $medLang->SetDBPassword($dbPassword,$dbUser);
> > > > > $medLang->AddDBParam('fkMediator',$rowID);
> > > > > $medLang->AddSortParam('Language','ascend');
> > > > > $medLangResult=$medLang->FMFind();
> > > > >
> > > > > $medLanguages = array();
> > > > > foreach($medLangResult['data'] as $medLangData){
> > > > > array_push($medLanguages, $medLangData['Language'][0]);
> > > > > }
> > > > > print_r ($medLanguages); //this works fine
> > > > >
> > > > > //second query for all value list languages
> > > > > $groupSize ='All';
> > > > > $LangAll=new FX($serverIP,$webCompanionPort,'FMPro7');
> > > > > $LangAll->SetDBData($fmFile,'VLLanguages',$groupSize);
> > > > > $LangAll->AddSortParam('Language','ascend');
> > > > > $LangAll->SetDBPassword($dbPassword,$dbUser);
> > > > > $LangAllResult=$LangAll->FMFindAll();
> > > > >
> > > > > foreach($LangAllResult['data'] as $key=>$LangAllData){
> > > > >
> > > > > $langRecid = $LangAllData[recid][0];
> > > > > $vlLanguage = $LangAllData[Language][0];
> > > > >
> > > > > echo '<input type="checkbox" name="vlLanguage" value="'
> > > .
> > > > > $vlLanguage . '">'; //this works fine
> > > > > if(in_array($LangAllData,$medLanguages)) {
> > > > > echo 'checked=\"checked\" '; //this DOES NOT WORK
> > > > > }
> > > > > echo $vlLanguage;
> > > > > }
> > > > > ?>
> > > > >
> > > > > Any ideas where I went wrong ? been bashing my head for a few hours
> > > > > now - and I did hope to get it done before I went off !
> > > > >
> > > > > Kind Regards
> > > > >
> > > > > William
> > > > >
> > > > > On 10/12/07, Steve Winter <steve at bluecrocodile.co.nz> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hi William,
> > > > > >
> > > > > >
> > > > > >
> > > > > > Okay, I'll play... I think I understand what you want to do, with the
> > > > > first
> > > > > > part of your query, then we'll see if I get that right, and then I'll
> > > > have
> > > > > a
> > > > > > go at the second part...
> > > > > >
> > > > > >
> > > > > >
> > > > > > I assume that the values returned by the contactAreas search will be a
> > > > > > subset of the records in the VLAreas table...? If that's correct, this
> > > > is
> > > > > > what I'd do...
> > > > > >
> > > > > >
> > > > > >
> > > > > > $contacts = array();
> > > > > >
> > > > > > foreach($contactAreas['data'] as $contact)
> > > > > >
> > > > > > array_push($contacts, $contact['area'][0])
> > > > > >
> > > > > >
> > > > > >
> > > > > > foreach($VLAreas['data'] as $area) {
> > > > > >
> > > > > > echo '<p><input type="checkbox" name="area[]" value="'.$area.'"';
> > > > > >
> > > > > > if(in_array($area,$contacts)) echo ' checked="checked"';
> > > > > >
> > > > > > echo '>'.$item.'</p>';
> > > > > >
> > > > > >
> > > > > >
> > > > > > Which should give you a checkbox for all of the records in VLAreas,
> > > with
> > > > > > those checkboxes for which there is a record in contactAreas...
> > > > > >
> > > > > >
> > > > > >
> > > > > > Now what you need to do is post the data back to FMP... I'd pass the
> > > > > parent
> > > > > > ID in the form that you send...
> > > > > >
> > > > > >
> > > > > >
> > > > > > When you post the data back to the receiving page you should end up
> > > with
> > > > > an
> > > > > > array called contact, which has the values which have been checked in
> > > > > it...
> > > > > >
> > > > > >
> > > > > >
> > > > > > What I would then do is re-perform your initial search, and create an
> > > > > array
> > > > > > of the records from contactAreas which has the –recID as the key and
> > > the
> > > > > > area as the value, so;
> > > > > >
> > > > > >
> > > > > >
> > > > > > $contacts = array();
> > > > > >
> > > > > > foreach($contactAreas['data'] as $key => $contact)
> > > > > >
> > > > > > $contacts[$key] = $contact['area'][0];
> > > > > >
> > > > > >
> > > > > >
> > > > > > Then I'd loop through my posted array and see if the record already
> > > > > > exists... if it does, then that's great, if not add it...
> > > > > >
> > > > > >
> > > > > >
> > > > > > foreach($_REQUEST['area'] as $area) {
> > > > > >
> > > > > > if(!in_array($area,$contacts)) {
> > > > > >
> > > > > > // this means that a new area has been checked
> > > > > >
> > > > > > // create a new record
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > > Now you need to do the opposite and find out if any have been
> > > > unchecked...
> > > > > >
> > > > > >
> > > > > >
> > > > > > foreach($contacts as $contactKey => $contactValue) {
> > > > > >
> > > > > > if(!in_array($contactValue,$_REQUEST['areas'])) {
> > > > > >
> > > > > > // this means that the box has been unchecked
> > > > > >
> > > > > > // so use $contactKey to delete the record
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hope this makes sense... not tested, but looks solid to me...
> > > > > >
> > > > > >
> > > > > >
> > > > > > Cheers
> > > > > >
> > > > > > Steve
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: fx.php_list-bounces at mail.iviking.org
> > > > > > [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of
> > > > > > William Downs
> > > > > > Sent: Friday, 12 October 2007 3:56 p.m.
> > > > > > To: FX.php Discussion List
> > > > > > Subject: [FX.php List] 2 value Lists together help
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hi Guys,
> > > > > >
> > > > > >
> > > > > >
> > > > > > A quick question (OK, I say quick but that word means different things
> > > > > >
> > > > > > to different people)
> > > > > >
> > > > > > I run the following query on 3 tables in Filemaker.
> > > > > >
> > > > > >
> > > > > >
> > > > > > find the Parent record from Contacts table
> > > > > >
> > > > > > find any associated child records from ContactAreas table
> > > > > >
> > > > > > find ALL records from VLAreas table
> > > > > >
> > > > > > Works fine.
> > > > > >
> > > > > >
> > > > > >
> > > > > > I need to be able to say in PHP - display a checkbox alongside any of
> > > > > >
> > > > > > the records from the VLAreas table (I can do that) and if some of the
> > > > > >
> > > > > > values from the ContactAreas table matches any of the values from the
> > > > > >
> > > > > > VLAreas table, then let the box be checked (sort of like comparing 2
> > > > > >
> > > > > > arrays I think)
> > > > > >
> > > > > >
> > > > > >
> > > > > > I then of course have to be able to FMEdit the changes.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Does someone already know how to do this ?
> > > > > >
> > > > > >
> > > > > >
> > > > > > Many kind thanks in advance
> > > > > >
> > > > > >
> > > > > >
> > > > > > William
> > > > > >
> > > > > > _______________________________________________
> > > > > >
> > > > > > FX.php_List mailing list
> > > > > >
> > > > > > FX.php_List at mail.iviking.org
> > > > > >
> > > > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > > > >
> > > > > >
> > > > > >
> > > > > > No virus found in this incoming message.
> > > > > >
> > > > > > Checked by AVG Free Edition.
> > > > > >
> > > > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > > > 11/10/2007
> > > > > > 3:09 p.m.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > No virus found in this outgoing message.
> > > > > > Checked by AVG Free Edition.
> > > > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > > > 11/10/2007
> > > > > > 3:09 p.m.
> > > > > >
> > > > > > _______________________________________________
> > > > > > FX.php_List mailing list
> > > > > > FX.php_List at mail.iviking.org
> > > > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > William Downs
> > > > > Development and Support
> > > > > BD Databases Ltd
> > > > > _______________________________________________
> > > > > FX.php_List mailing list
> > > > > FX.php_List at mail.iviking.org
> > > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > > >
> > > > > No virus found in this incoming message.
> > > > > Checked by AVG Free Edition.
> > > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > > 11/10/2007
> > > > > 3:09 p.m.
> > > > >
> > > > >
> > > > > No virus found in this outgoing message.
> > > > > Checked by AVG Free Edition.
> > > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > > 11/10/2007
> > > > > 3:09 p.m.
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > FX.php_List mailing list
> > > > > FX.php_List at mail.iviking.org
> > > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > > >
> > > >
> > > >
> > > > --
> > > > William Downs
> > > > Development and Support
> > > > BD Databases Ltd
> > > > _______________________________________________
> > > > FX.php_List mailing list
> > > > FX.php_List at mail.iviking.org
> > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > >
> > > > No virus found in this incoming message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > 11/10/2007
> > > > 3:09 p.m.
> > > >
> > > >
> > > > No virus found in this outgoing message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
> > > 11/10/2007
> > > > 3:09 p.m.
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > FX.php_List mailing list
> > > > FX.php_List at mail.iviking.org
> > > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > > >
> > >
> > >
> > > --
> > > William Downs
> > > Development and Support
> > > BD Databases Ltd
> > > _______________________________________________
> > > FX.php_List mailing list
> > > FX.php_List at mail.iviking.org
> > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > >
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date: 11/10/2007
> > > 3:09 p.m.
> > >
> > >
> > > No virus found in this outgoing message.
> > > Checked by AVG Free Edition.
> > > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date: 11/10/2007
> > > 3:09 p.m.
> > >
> > >
> ? >
> > > _______________________________________________
> > > FX.php_List mailing list
> > > FX.php_List at mail.iviking.org
> > > http://www.iviking.org/mailman/listinfo/fx.php_list
> > >
> >
> >
> > --
> > William Downs
> > Development and Support
> > BD Databases Ltd
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
>
>
> --
> William Downs
> Development and Support
> BD Databases Ltd
>
--
William Downs
Development and Support
BD Databases Ltd
More information about the FX.php_List
mailing list