Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#URL.firstname# shows CGI variables 1

Status
Not open for further replies.

johngrg

Programmer
Apr 19, 2007
17
US
I'm a newbiE to CF. Lately I came across ColdFusion script embedded w/ ASP that I had to debug.

1. In the Employee.cfm there are two input boxes, firstname and lastname and Search button. When this form is opened from another form, <cfoutput> #url.firstname# </cfoutput> shows entire CGI variables (like HTTP_FIRSTNAME = Roby, HTTP_LASTNAME = Canton, HTTP_TITLE=Employee, HTTP_...) instead of being blank the first time when this form is opened as user has not even entered any data on the input boxes. What could trigger this from happening? I've tried #form.firstname# thinking it would be blank until the user enters some data, but got the same result as above.

I've been scratching my head over this for few days w/o success. Why is the CGI values showing w/o the user entering any data on the input boxes? And how can I resolve this problem?

But, after user enters their search criteria firstname & lname in the input box, then it correctly displays the user input data. eg. if user enters Roby as first name then the above code shows just Roby. Not the entire HTTP_FirstName,... like before.


2. How do I get the entire current URL from ColdFusion?

For example, if a user is at:


Is there no easy way of getting this out of ColdFusion?

Any help will be greatly appreciated. Thankyou.
 
<cfoutput>#cgi.HTTP_HOST##cgi.SCRIPT_NAME#?#cgi.QUERY_STRING#</cfoutput>

...ought to give you the whole url.
 
That worked excellent. Thanks.

On Ques 1., would you know why #URL.firstname# would grab the HTTP header information? Is there anyway to avoid getting the HTTP header info from the URL?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top