LiveWire Peer Support Network

Printable Version of Topic "Second Day and I am allready confused"

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- Second Day and I am allready confused (http://www.golivewire.com/forums/peer-yaaanot-support-a.html)


-- Posted by GdFtherOFCOWS at 6:32 pm on June 25, 2008

I don't know how to word this, so if you need clarification, you are out of luck most likely.  They didn't explain it that well to me either.

My task for the time being is to set up a webpage that instead of different pages for different states, instead sets up just one page and loads up the appropriate one for the right state.

So instead of this


walmart.com/default.html <-- Gets info using about which state you are in

wal-mart.com/AL/client.html <--- Sends you each states own page

we want this


walmart.com/default.html  <-- Loads up like normal

walmart.com/defualt.html?state=AL <-- then does this with the state code for the state

walmart.com/setup.html <-- If the state doesn't have a page, or an error occurs, the setup.html loads

I have no idea what the second part is called, and with that, no code examples to work off of.  Any help?


-- Posted by i who have nothing at 6:42 pm on June 25, 2008

Umm.  I'm not sure how to do it in JS but in PHP you'd just do

Code:

$state = $_GET['state'];

if ( $state == 'AL' )
{
do this
}
if ( $state == 'something else')
{
do this
}

So yeah.  Just google JS and the GET function.


-- Posted by sakurag at 3:16 pm on June 30, 2008

This really depends on the language you are writing your pages in.  In the simplest terms, you can use some sort of switch method and have the 'default' or 'error' condition send you to the other page.

For extra points, make sure that all errors have a case.  This way, in the future, you do not have to modify the page much to add additional functionality.


-- Posted by Zimmy at 4:10 am on July 5, 2008

Your not going to do it in straight HTML.  Period.  You'll need to use PHP, Perl, or ASPX depending on your web server and what it supports.    Best coding stragedy would be a select block with all the potential options for ?state=.  This would be done in a standard "select case", and also allow a generic handler (if it doesn't match any of your specified strings) to lead to an error page and/or the default page.


www.golivewire.com