Login | Register | FAQ
Anonymous

strange form redirecting ?!

+ Post a reply

7 posts Page 1 of 1


strange form redirecting ?!

by freeAngel » Fri Oct 29, 2010 2:43 pm

Hi guys,

i have a problem with html form

Code: Select all
       <form  action="?history"  method="GET">
           <select name="year" onchange="this.form.submit()">
               <option value="2010">2010</option>
               <option value="2009">2009</option>
           </select>
       </form>


ok, after you select 2009 item - it should go to "localhost/?history&year=2009", but its going to "localhost/?year=2009"

its weird. newer happen to me before. i tested it on ie8, firefox , chrome. and all with same result.

do anyone know what can be a problem?

thx. for all answers
User avatar

freeAngel

  • Posts: 2
  • Joined: Fri Oct 29, 2010 2:18 pm

Re: strange form redirecting ?!

by lacroixz » Fri Oct 29, 2010 4:09 pm

Maybe in here!
Code: Select all
<form action="?history" method="GET">


The question mark might be the problem, or maybe the use of capital letters like "GET".
Otherwise I've got no idea, goodluck! :)
User avatar

lacroixz

  • Posts: 74
  • Joined: Wed Oct 27, 2010 9:26 pm

Re: strange form redirecting ?!

by freeAngel » Fri Oct 29, 2010 6:54 pm

haha,

i created 2 html files index.html and index2.html

index.html
Code: Select all
<html>
<body>

  <form  action="index2.html?history"  method="get">
               
  <select name="year">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
<input type="submit" value="submit">
</form>
</body>
</html>



index2.html
Code: Select all
<html>
<body>
Hello world.
</body>
</html>


ok when i choose "volvo" /or other item/ then i submit form in index.html it should redirect to "localhost/index2.html?history&year=volvo" right? but it redirects me to "localhost/index2.html?year=volvo" and thats strange.

---------
ok it works with method="post" but dont works with method="get"

anyone know what can be the problem?
User avatar

freeAngel

  • Posts: 2
  • Joined: Fri Oct 29, 2010 2:18 pm

Re: strange form redirecting ?!

by lacroixz » Sat Oct 30, 2010 12:26 pm

freeAngel wrote:haha,

i created 2 html files index.html and index2.html

index.html
Code: Select all
<html>
<body>

  <form  action="index2.html?history"  method="get">
               
  <select name="year">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
<input type="submit" value="submit">
</form>
</body>
</html>



index2.html
Code: Select all
<html>
<body>
Hello world.
</body>
</html>


ok when i choose "volvo" /or other item/ then i submit form in index.html it should redirect to "localhost/index2.html?history&year=volvo" right? but it redirects me to "localhost/index2.html?year=volvo" and thats strange.

---------
ok it works with method="post" but dont works with method="get"

anyone know what can be the problem?


Maybe because u've got ->

Code: Select all

<select name="year">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>


I mean '<select name="year">
User avatar

lacroixz

  • Posts: 74
  • Joined: Wed Oct 27, 2010 9:26 pm

Re: strange form redirecting ?!

by HTML.net » Sun Oct 31, 2010 11:11 am

Did you find a solution? Otherwise, try this:

Code: Select all
<select onchange="window.location=this.value">
   <option value="index2.html?history&year=volvo">Volvo</option>
   <option value="index2.html?history&year=saab">Saab</option>
   <option value="index2.html?history&year=mercedes">Mercedes</option>
   <option value="index2.html?history&year=audi">Audi</option>
</select>


- Andreas, HTML.net
User avatar

HTML.net
Site Admin

  • Posts: 1194
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.

Re: strange form redirecting ?!

by saeednri2 » Sat Sep 03, 2016 9:22 am

use of capital letters! I think!
طراحی سایت
User avatar

saeednri2

  • Posts: 4
  • Joined: Sat Sep 03, 2016 9:19 am

Re: strange form redirecting ?!

by dejavu » Wed Sep 28, 2016 3:41 pm

Did you find the solution?
User avatar

dejavu

  • Posts: 7
  • Joined: Wed Sep 28, 2016 2:10 pm


+ Post a reply

Page 1 of 1