Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Filter individual fields on PHP form

New Here ,
Feb 26, 2013 Feb 26, 2013

I have a form linked to a recordset.

On the form, I want to display the contents of field2 when field1 equals a value that I insert in the code.

For instance: A recordset has a field called Color and another field called Quantity.

On the form, next to the word "Red", I want to display the contents of the field "Quantity" when "Color" = "red"

I DO NOT want to use Repeat Region to list all of this as a table. Instead, I want to place the fields where I want them.

So I might have something like the following:

Red (34)      Blue (12)

Green (16)  Black (45)

Etc.

Is there a way to place a condition (Color = "Red") on an individual field without having to create a seperate recordset for every field (I have 67 fields on this form!)?

Can I drag a recordset field onto the text field and then add a filter to it?

TOPICS
Server side applications
953
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2013 Feb 26, 2013

Please show us your database design and SQL query you are using for the recordset.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2013 Feb 27, 2013

The database table in my example is called Hats and has two fields: Color and Quantity

The sql query is

SELECT * FROM Hats

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2013 Feb 27, 2013
LATEST

OK, I don't really know PHP but an overall strategy could be to load the recordset into a 2 dimensional associative array.  Then you could could reference the row attribute (qty) by the 'color'.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines