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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate state and redirect user according to state id

Status
Not open for further replies.

hoasabi

Programmer
Oct 23, 2006
3
US
Hi, I have to redirect the user to 2 different page, according to the state they're in. Do i need to set the state as a variable and then do a redirect (cflocation) to direct them to that page? How can i validate what state they're in to redirect them? I'm sure this is simple but i'm new to coldfusion, can anyone help me?
Thank you so much!
 
what is the definition of the "state"? is it like an administrator / user ? if so, you would create something like

<cfset SESSION.User.Role = "administrator">

after they login. thereafter,

<cfif SESSION.User.Role IS 'administrator'>
<cflocation url="...">
<cfelse>
<cflocation url="...">
</cfif>

hope it helps...


 
Thanks for the reply.

Let's say the state IDs are "IN" and "FL". So if they're in IN, they will be directed to the indiana page and likewise for FL. Would I need to do a cfset for IN and FL and then cflocation them?

Thank you so much!
 
How do you know what state they're in? Do they select it from a list? Is it part of their account profile?

You certainly can't tell by their connection (although some services make that attempt). You can't validate what they enter. I could sign up and give you an address I had in North Pole, Alaska twenty years ago.

I think we need to know a bit more about your application and what you know about your users before we can proceed.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
I could sign up and give you an address I had in North Pole, Alaska twenty years ago.
Woah! [surprise]
Did you really live at the North Pole? Cool! Ever see Santa? [santa]

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
He would show up at Santa Claus House every now and then, and have a pizza at the Elf's Den. (Google 'em; I ain't kidding!)

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Well, if the user is selecting the state from a drop-down box then you can redirect the user based on what choice they made. That part is easy. But then you'd have to address philhege's questions on how you decipher what state the user is in.

Do you redirect the user once they log into the application (like a registered user) or do you redirect the general public (ie, not logged in, visitor, etc)?

Does the redirected location make a (huge) difference to what the user wants to do? Can they go back and choose the right state, assuming they made a mistake?

We'd need more insight onto what this app does so we can better assist.

____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top