The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> US state drop down box and submit button
galapagos
post Dec 9 2009, 01:18 PM
Post #1





Group: Members
Posts: 2
Joined: 9-December 09
Member No.: 10,542



hi everyone. I am trying to create US states drop down box and submit button, so that once a person is on the site and wants to choose his/her state, they can do it. Here's url: www.uvinfo.com .
here's my code:


CODE

<form method="get" action="./"><select name="state">
<option selected="selected" value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option></select>

<input value="Submit" type="submit" />
<center></center></form>



the thing is once you're lets say on:

http://uvinfo.com/Articles.php and choose a state , lets say California, it brings you back to index page which it shoudn't be according to what I am trying to accomplish. It should stay on same page but with California in the State box.

appreciate your assistance!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 9 2009, 01:55 PM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,312
Joined: 9-August 06
Member No.: 6



Because of this: action="./". If you use action="http://google.com", it will go to Google. But if you leave the URL out altogether, the form will be submitted to the current page, i.e. the page will reload and the selection will be lost.

Just curious, what's the point of a dead form? Isn't anything more going to happen?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Dec 9 2009, 02:02 PM
Post #3


WDG Member
********

Group: Root Admin
Posts: 8,302
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



That's what action="./" does. Please see the discussion of relative URLs in the FAQ entry How can I avoid using the whole URL?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
galapagos
post Dec 9 2009, 03:24 PM
Post #4





Group: Members
Posts: 2
Joined: 9-December 09
Member No.: 10,542



thanks a lot. I changed it to:

CODE
<form method="get" action="#list"><select name="statecode" id="select">
<option value="AK">Alaska</option>
<option value="AL">Alabama</option>
<option value="AR">Arkansas</option>
<option value="AZ">Arizona</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DC">Washington D.C.</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="IA">Iowa</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="MA">Massachusetts</option>
<option value="MD">Maryland</option>
<option value="ME">Maine</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MO">Missouri</option>
<option value="MS">Mississippi</option>
<option value="MT">Montana</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="NE">Nebraska</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NV">Nevada</option>
<option value="NY">New York</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VA">Virginia</option>
<option value="VT">Vermont</option>
<option value="WA">Washington</option>
<option value="WI">Wisconsin</option>
<option value="WV">West Virginia</option>
<option value="WY">Wyoming</option></select><input value="Submit" type="submit" />
<center></center></form>




so
CODE
action="#list">


makes it stya on same page, but state jumps back to the first one in the list which is Alaska, how do I prevent it?



Pandy wrote
QUOTE
Just curious, what's the point of a dead form? Isn't anything more going to happen?


I want to put different quote providers there later
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Dec 9 2009, 04:33 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,302
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
but state jumps back to the first one in the list which is Alaska, how do I prevent it?
Have a server-side (e.g., CGI, PHP) program generate the page, and have it change which option is selected to match the submitted value.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 10 2009, 01:05 AM
Post #6


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,312
Joined: 9-August 06
Member No.: 6



QUOTE(galapagos @ Dec 9 2009, 09:24 PM) *

I want to put different quote providers there later


Not sure if you mean the user will get transported to another page or what, but whatever it is, the situation you have now doesn't really apply. If, for instance, you want to take the user to another page and keep the selected option selected, that's a problem in that end, after you do whatever you do, not before.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th July 2019 - 11:56 PM