View Single Post
Old 01-28-2013, 04:16 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,552
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You aren't "escaping" the values. So, for example, if you put the value "30x+" into the URL, that + is seen as space character. *ALL* + signs are seen as spaces: It is one of the accepted encodings of space (the other is %20). If you want a real + sign, you must encode it.

On top of that, because you are using a SUBMIT button, the *NORMAL* action of the <form> is *STILL* performed. So very likely the normal submit action wipes out your location.href.

But I have to ask: *WHY* do it this way??? What's wrong with just using HTML and getting the JavaScript OUT OF THE WAY!!!

Why not simply:
Code:
<form action="http://www.redlinewheel.com/index.php" method="get">
<input type="hidden" name="pname" value="N"/>
<input type="hidden" name="pfull" value="Y" />
<input type="hidden" name="cid" value="0" />
<input type="hidden" name="pcode=" value="" />
<input type="hidden" name="price_from=" value="" />
<input type="hidden" name="price_to=" value="" />
<input type="hidden" name="weight_from=" value="" />
<input type="hidden" name="weight_to=" value="" />
<input type="hidden" name="dispatch[products.search]" value="Search" />
<input type="hidden" name="q"/>
<select name="redline_inches"> ... </select>
<select name="redline_boltpattern"> ... </select>
<input type="submit" value="search now" 
       onclick="this.form.q.value = this.form.redline_inches.value + "+" + this.form.redline_boltpattern.value;" />
</form>
Let the browsers normal form submit do all the work of making the correct "escapes" for you.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote