Skip to main content
Known Participant
September 11, 2007
Answered

Search/Search Results Page

  • September 11, 2007
  • 3 replies
  • 1123 views
I have a simple PHP/mySQL database that I have set up and that DW can see. I am able to successfully set up a dynamic table for all of the fields in the table; I can view all rows and all data in Firefox.

However, when I go into the recordset and set up a variable and a simple SQL query, I am unable to see any results on the page even though the coded field names are transferring to my php page. I have attached my code. The Variable info is as follows:

Name: Submit
Type: Text
Default Value: abc
Run Time Value: #Submit#

On my search page, my form text field is: "Submit." My Button's Name and Value are both "Submit." Lastly, the action on the search page has the name of the file where the recordset is located.

Any ideas? Thanks so much for your help!
Sead01

This topic has been closed for replies.
Correct answer Günter_Schenk
>>
I don't understand. And I have read what you have write to Günter. Any way, but its not me that have a problem
>>

I for once do indeed see a *huge* problem with the form code :: all your form elements (the form itself, the text field, and the button) all carry the same "name", what´s actually turning into a conflict for "test1.php", because this file expects just *one* form element with the name/id "searchfor" to provide the search string, and not several ones.

please rename the "name" and id" of your...

- form : to "form"
- text field: to "searchfor"
- submit button: to "submit"

and see if it works.

3 replies

September 13, 2007
>Thanks for your help. I am using GET, and your suggestions did not work out >as that is the Run Time Value I have inserted.

I don't understand. And I have read what you have write to Günter. Any way, but its not me that have a problem.

Let me ask:

Is your Run-Time Value of the Variable 'submit' this:
$_Post['searchfor'];

?

Thanks
Sead1Author
Known Participant
September 13, 2007
olcram,

Thanks again for your time.

I chose the GET method in the form and my run time value is: $_GET['searchfor']

Gunter helped me to fill out the simple form within the recordset. When I ran the test, it asked me for a variable and I placed one (that is in the database) into the field; it returned a correct result. Therefore, DW and the database seem to be communicating.

So the question becomes why is the DW php results page not picking up on the variable sent to it. Gunter feels that it might be a problem with the form.

Any other ideas?

Thanks,

Sead01
September 12, 2007
1- I'm not an expert on this.

What is the "method" of your form? Post, Get ?
Normally in the Run Time Value with should have (in php/mysql case):

$_Post[''the_name_of_your_textfield_to_search']; or $_Get['the_name_of_your_textfield_to_search'];

Hope this helps.
Günter_Schenk
Inspiring
September 12, 2007
>>
What is the "method" of your form? Post, Get ?
>>

it´s "Get", as the variables/values are getting added to the URL (?searchfor=CO&Submit=Submit)

However, I personally find building such rather simple queries *a lot* easier with DW´s "Recordset" Server Behaviour -- here´s where you select the desired table and columns, plus define your "Filter" condition like this:

1st row.

a) Filter: select the "state" column

b) menu to the right starting with "=" :: select the "contains" option (will generate the "LIKE" in the query)

2nd row:

a) as you´re currently passing the search values via URL parameter, decide on the menu´s default "URL parameter" option

b) enter "searchfor" (without quotes) to define the previous page´s text field "searchfor" as data source

All this will be creating the correct query, and will also be checking if the URL parameter "searchfor" has actually been set
Sead1Author
Known Participant
September 12, 2007
Gunter,

Thanks again for your time but unfortunately your idea did not work.

Once I fill out the Simple version of the Recordset as you suggested and click Test, it asks for a variable; and if I put one in (one that is included in the table) it successfully pulls up the appropriate data.

So this is why I think it is a DW issue and not an Apache or mySQL issue!

Do you think my problem could be with Apache or the permissions in mySQL?

It just seems odd that DW can pull up all data in my SQL table if the permissions are not correct; and that a test in the Recordset window yields a correct/desired result!

Why is the DW PHP page not picking up on the submitted form?
Could I be inserting the dynamic data into the PHP page incorrectly?
Any more ideas?

Thanks again and have a good one!

Sead01
Günter_Schenk
Inspiring
September 11, 2007
what happens when you rename the text field´s "name" (and "id") to, say, "searchfor" and define this as run time value ?
Sead1Author
Known Participant
September 12, 2007
Thanks so much for your reply.

Just to make sure I understood what you had in mind I did the following:

1. On the search page text field name box I put searchfor
2. On the search results page I changed the runtime value to #searchfor#

I still did not get a results page with data. This is what appears in the Mozilla browser window:
localhost/eps//test1.php?searchfor=CO&Submit=Submit

Any other ideas?
Thanks again.

Sead01