Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Searching a related field using checkbox

Featured Replies

Find all accepted proposal

re: $view_detail = $_POST['view_detail'];

view_detail is an Array. So you may need to extract the elements and use an "or" in the search.

Good Luck.

Garry

  • Author

Hi Gary,

Thank you for the help. I am not clear what you meaning about use an "or" in the search.

PHP2005

I'm not sure where the $value variable is coming from:

<?php echo ''.$value; ?>

The "OR" would be added like this:

$findrecord->AddDBParam("-lop","or");

It indicates to FM to find any of the values in the view_detail list.

You still have to convert the view_detail Array to a list.

Do you have a view_detail field in your database? If so, what type of data does it contain? That is, what are you searching for? Maybe you should be searching for RecordIDs.

All the best.

Garry

A couple of things

Index.php

In the form I see no 'info_ID' defined

show_all.php

You cannot POST an array (believe me I tried).

So your view_detail that you are posting needs to be broken into a list:

Input name=viewdetail1

input name=viewdetail2

title_detail_list.php

Your POST data would need to correspond to what you are submitting for show_all.php

One great way to get all the $_REQUEST values from the array into variables is the following script I picked up:

foreach($_REQUEST as $key=>$value)

{

$$key=$value;

}

it may help.

As Gary says

Good Luck!

  • Author

Hi Garry,

Thank you for the help.

The value of <?php echo ''.$value; ?>are comming from a simple database.

I did try to search using theRecordIDs, but it is bringing me the entire records instead bring me only the ones I had checked on search_all.php to be displayed on title_detail_list.php. I am not sure what I am missing. I am attaching the zip file to see if you can give me an idea what am I missing.

thank you!

:

search.zip

I need the login details for the database.

Garry

  • Author

Hi Garry,

The Login is:

Account Name: admin

Password: monkey

Thank You

In the "show_all.php" page change the chaeckbox to look like this:

In the "title_detail_list.php" page have this:

if(isset($_GET['Info_ID']))

{ $Info_ID = $_GET['Info_ID'];};

if(isset($_POST['view_detail']))

{ $Info_ID = implode(" ",$_POST['view_detail']);};

$findrecord=new FX($serverIP,$webCompanionPort);

$findrecord->SetDBData('file.fp7','Main');

$findrecord->SetDBPassword('monkey','admin');

$findrecord->AddDBParam("Info_ID",$Info_ID);

$findrecord->AddDBParam("-lop","or");

$findrecordResult=$findrecord->FMFind();

Working fine :

All the best.

Garry

  • Author

Hi Garry,

Thank You, I will it try now.

PHP

  • Author

Hi Garry,

I did try the code, but for some reason when I check more than 1 checkboxes on search_all.php page, I keep getting the following error on title_detail_list.php page:

Found Count = -1

Error Code = 401

But if I check only 1 checkbox, it works fine.

Do you have any idea why I keep getting the error message?

Thank You

Did you include the [] square brackets with the checkbox name:

view_detail[]

Is the "or" correct.

You can test manually with:

$findrecord=new FX($serverIP,$webCompanionPort);

$findrecord->SetDBData('file.fp7','Main');

$findrecord->SetDBPassword('monkey','admin');

$findrecord->AddDBParam("Info_ID","S103 S104 S105");

$findrecord->AddDBParam("-lop","or");

This list ("S103 S104 S105") is being created by the implode() function from the view_details[] array.

Good Luck.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.