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

Search/Search Results Page

New Here ,
Sep 11, 2007 Sep 11, 2007
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

TOPICS
Server side applications
1.1K
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

correct answers 1 Correct answer

Guide , Sep 13, 2007 Sep 13, 2007
>>
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...
Translate
Guide ,
Sep 11, 2007 Sep 11, 2007
what happens when you rename the text field´s "name" (and "id") to, say, "searchfor" and define this as run time value ?
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 ,
Sep 11, 2007 Sep 11, 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
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
Guest
Sep 12, 2007 Sep 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.
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
Guide ,
Sep 12, 2007 Sep 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
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 ,
Sep 12, 2007 Sep 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
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
Guide ,
Sep 12, 2007 Sep 12, 2007
>>
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
>>

ok, this shows that the generated query is alright now and does what it´s supposed to -- so I think we´ll need to see the previous page´s form, because I assume there´s probably something wrong in there.

can you please copy & paste the form code only ?
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 ,
Sep 13, 2007 Sep 13, 2007
Gunter,

Here is the code. It is the same for both the .php and .html versions that I have tried.

Thanks again for your attention.

Sead01
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 ,
Sep 12, 2007 Sep 12, 2007
sea
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 ,
Sep 12, 2007 Sep 12, 2007
olcram,

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.

If you have a chance, take a look at the note that I wrote to Gunter.

Any more ideas?

Again I appreciate your help!

Sead01
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
Guest
Sep 13, 2007 Sep 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
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 ,
Sep 13, 2007 Sep 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
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
Guide ,
Sep 13, 2007 Sep 13, 2007
>>
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.
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 ,
Sep 13, 2007 Sep 13, 2007
Gunter!

You are the best! In appreciation, I am sending you a fantastic cyberbeer and a fine bottle of cyberwine (unfortunately they do not seem to carry great aged Single Malt Scotch).

Seriously though, I really appreciate your time and help on this.

Thanks again,
Sead01
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
Guide ,
Sep 13, 2007 Sep 13, 2007
LATEST
Hi Sead01,

LOL 🙂 Thanks for that, I just received your cyber-drinks in a cyber-parcel, and it tastes like -- well, just indescribable :-)

Cheers !
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