We help IT Professionals succeed at work.

Recordset filter with $_GET in PHP and Dreamweaver

palmtreeinfotech
on
Hello experts.  What I basically have is a page with a dynamic drop-down with company names as the ID as the value (i.e, 1 = companyA, 2=CompanyB, etc.) and trying to pass multiple params to the next page to filter the recordset.  I am using Dreamweaver CS5 for this.

form field 1 (called search3) the dynamic dropdown using values in the DB
form field 2
form field 3
form field 4

Page 1 is the dropdown with a submit button.  It passes the ID value to the next page using a simple recordset and setting the URL parameter equal to the textbox drop-down of "search3".  I have additional textboxes for additional search params on the same page.

Then I am using $_GET['form field 1]' and setting the results page from GET on the search form.  However, I can't get it to work.  Here is my SQL in the Dreamweaver recordset:

SELECT * FROM tblLoad_Master WHERE Company_Name_ID = colname OR Master_Agreement_ID = manum OR Ins_Contact_Add1 = address OR Ins_Contact_State = state

Colname is the name of the first parameter DW came up with and it points to my dynamic recordset [search3].  It seems to filter the Company_Name_ID okay but nothing else.  Suggestions?

Then I added the other parameters with $_GET for the rest of the variables.

And the default is "-1" on the params, integer on the company_id and text on the rest.

I can read code pretty good but not write it.  I have attached my 2 php pages. search-company.php search-filter45.php
Comment
Watch Question

Most Valuable Expert 2011
Top Expert 2016

Commented:
I don't think I can debug your code, but I can suggest a strategy that may be helpful.  Look at the data as it is created or gathered from external sources like HTML forms.  You can usually find it in $_REQUEST.  If you echo "<pre>" before var_dump() you will find the output easier to read.

Add this near the top of the scripts:

echo "<pre>";
var_dump($_REQUEST);

Author

Commented:
Ray, thanks for your comments.  Is the code wrong in some way where you can't see it?
Most Valuable Expert 2011
Top Expert 2016
Commented:
In search-company.php there is a form with this attribute set :

method="get" action="search_filter45.php"

When that form is submitted, the data from the client request will be sent to the script at the URL search_filter45.php

Inside search_filter45.php between lines 2 and 3 add these instructions:

echo "<pre>";
var_dump($_GET);
die();

That will show you exactly what the form script submitted to the action script (under control of the client interaction).  Once you see that data, then the next thing you might want to do is look at the fully resolved query string.  You might want to use var_dump($query_limit_Recordset1) immediately before the mysql_query() statement.

Regarding this: "However, I can't get it to work."  Usually there is some kind of output; a parse error, or a query error or something written into the browser output stream, like maybe some HTML.  It would be necessary to see those things to make any progress.

I don't think I can debug the code; I cannot understand what it is trying to do, and I do not have your data base, so I cannot see any of the output from these scripts.  But hopefully you understand the objective and when you can see the data, it should help clarify things.  If you want to make those changes and post the output back here, I will be glad to take a look at things.

Author

Commented:
Thanks Tom.  I will try that sir.  Thank you for responding.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.