ColdFusion Search Question/Help
I am working 开发者_如何学JAVAon a project that is written in ColdFusion. I dont have the most knowledge when it comes to ColdFusion so I am having a small problem where we are using a CF search engine. It searches through products. Also when you browse the products it uses the same page to display the results. My problem is that it is not passing the variables into the URL for the link when you do a search, but if I browse the page it shows up. (mypage.cfm?pid=1234&m=1256 when I search it returns NULL but when I browse it returns the correct number for the manufacturer) I didnt want to post the entire code because it is a long code. So my question isn't necessarily that I want you to fix this, but can you point me in the direction of how to learn how to resolve this situation.
When you search normally from a form those variables will end up as
form.pid
and form.m
when you browse via url, those variables will end up as
url.pid
and url.m
You can either change your form to use method="get"
rather than post or have code in your results page similar to this
<cfparam name="form.pid" default="" />
<cfparam name="form.m" default="" />
<cfparam name="url.pid" default="#form.pid#" />
<cfparam name="url.m" default="#form.m#" />
What this does is says, default form to nothing if its not defined Then default url to whats in form.
The end result will have url.pid
and url.m
with either form or url paramaters.
This assumes that the rest of your code is using the url paramaters, which im guessing might be right as you said it works when you browse it.
精彩评论