?
Solved

HREF search string help

Posted on 2003-03-14
8
Medium Priority
?
180 Views
Last Modified: 2013-12-24
Hi, I'm a little new to ASP and Coldfusion stuff.  All theses tags are making me sick.  My question is probably really simple, but for some reason I confused as to how variables are passed into a page through the URL.

Scenerio:
I have a directory listing that has 5 Levels (5 cf templates called (populate<name-of-level>.cfm).  You get to the next level by selecting a value from a drop down list that is basically a query dependent on the value of the previous levels passed argument.

Pseudo code:(populatestate.cfm)
SELECT * from listing
WHERE state = #Form.state#
where #Form.state# was passed into this page from main.cfm using a drop down list
show some content dependent on #form.state#

SELECT * from listing
WHERE state = #Form.state# & town = #town#  
do a drop down with #town# variable
Pass this argument to populatetown.cfm

...and so on and so forth till I get to the final level

LEVELS:
main > state > town > category > subcategory > listing

Well my question is (drum roll please)... I want to know how I can pass this #form.state# and #town# variable into the same page using a URL rather than a drop down list box with a submit button.  I've played with the URL but everthing i try doesn't seem to work...like (/populatetown.cfm?name=#form.state#) coming from any other page independent of level.  

The main reason I want to use the URL is so I can provide the user with a nice little tree structure like the one you see on the top of this website...

I also want to use the URL so I all my data inside my database can be seen by those internet search spiders.  Basically I want to create my own dynamic index.html file where everytime I submit a listing to my directory it will automatically generate the #url# search string.  The index file will just be a query of the column that holds the auto-generated url.

Thanks in advance for your response.  Any help, ideas, brainstorming, pointer to a previous thread, anything, will be appreciated.

-Bob

*NOTE* - My first born is unavailable if you answer this question correctly.
0
Comment
Question by:bobdinski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 8

Accepted Solution

by:
TallerMike earned 150 total points
ID: 8137243
/populatetown.cfm?name=#form.state# should work fine for you. And on the processing page, you can reference this variable like so:

url.name (not by form.name, this is only for information that is posted not sent using GET or though the URL).

Please...not first borns here
0
 

Author Comment

by:bobdinski
ID: 8137506
You know I was wondering if I was referencing the passed variable properly.  Just have to wait till I get home tonight and try it out on my server. (my company, blocks FTP).  Looks like I could use some Coldfusion101.  So many languages, so little time.

Thanks TallerMike  
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8137653
no problem, let me know if it works out for you...
0
The Ideal Solution for Multi-Display Applications

Check out ATEN’s VS1912 12-Port DP Video Wall Media Player at InfoComm 2017. Kerri describes how easy it is to design creative video walls in asymmetric layouts and schedule detailed playlists ahead of time with its advanced scheduling feature.

 
LVL 2

Expert Comment

by:weeezl
ID: 8137754
Just a note:

Although it's good practice, you don't HAVE to scope your variables. This can make things easier if you're not sure where they are coming from.

For example - If you wrote your query like this:

SELECT * from listing
WHERE state = #state# & town = #town#

In this case, ColdFusion will give a value to the variables regardless of whether they comes from a form, from the URL or are set within the page.

You could write your url like:
populatetown.cfm?state=#state#&town=#town#

and get the same exact results as if you passed these values in from a form submit.

There is also another CF tag that might be helpful to know. CFparam sets a default value for a variable if it is not defined anywhere else. So for example:

<cfparam name=state default=1>

This would set a default value for state=1 so that if the page didn't contain a url variable or a form post, it would still process the page with the default value.

Hope this helps.
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8137874
weeezl, which that is valid, it is not good practice. It is possible to have both form.state and url.state be different values. If you simply refer to it as 'state' there is no way to gaurantee which value you have gotten? And, it is slower for Cold Fusion to process this. Again valid, but bad practice.
0
 
LVL 2

Expert Comment

by:weeezl
ID: 8137892
I'm all for ease of use.

Would hate to lose those 10 miliseconds ;)
0
 

Author Comment

by:bobdinski
ID: 8138305
weeezl,

I like your thinking, but I'm all about scoping, especially when using a variable that essentially has 2 different forms or types.  Unfortuately this non-scoping method won't work since it will be possible for the user to pass both url. and form, on my site.

I'm checking out a good javascript to change the "?" variable to a "/" right now.  Looks kinda neat, although I think google now includes the "?" in thier web spider.

Thanks,

-Bob

 
0
 

Author Comment

by:bobdinski
ID: 8138363
weeezl,

I like your thinking, but I'm all about scoping, especially when using a variable that essentially has 2 different forms or types.  Unfortuately this non-scoping method won't work since it will be possible for the user to pass both url. and form, on my site.

I'm checking out a good javascript to change the "?" variable to a "/" right now.  Looks kinda neat, although I think google now includes the "?" in thier web spider.

Thanks,

-Bob

 
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question