Solved

get form bug : = becomes %3D ....

Posted on 2004-09-02
11
273 Views
Last Modified: 2010-04-09
Hi - This get form converts the '=' and '&' signs into '%3D' and '%26'


I tried giving the second value a name "myapple" but it still doesn't work however I play with it.


========
<body>

<form method="get">
<input type="hidden" name="keywords">

<input type="hidden" name="myapple" value="locale=us&mode=blended&input_string">



<input type="text" name="search" size="20" maxlength="255"><br />


<input type="submit"style="width:150;text-align:center" value="listings"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.isearch.com/cgi-bin/ppc/search/smartsearch.cgi?keywords ';"> <br />

<input type="submit"style="width:150;text-align:center" value="Amazon"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.theeas.com/cgi-bin//us.cgi?locale=us&mode=blended&input_string ';"> <br />

</form>  



</body>
</html>
0
Comment
Question by:macuser777
  • 5
  • 4
11 Comments
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
this is correct actually, you just need to decode (or unescape) the value passed, e.g.:

this.form.keywords.value = unescape(this.form.search.value)
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
OH WAIT!  I didn't see that you were changing the action of the form ... in that case do it in the cgi, not in the script as I have shown above.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>>>>I didn't see that you were changing the action of the form ... in that case do it in the cgi, not in the script as I have shown above.          

any way of doing it without going into the cgi? the cgi is an off the shelf which I have no idea how to get round. I know next to nothing...really next to...about cgi.

If there's no other way if you give me some guidance i'll get a freelance to do it.

theres a bit more to it...Thanks

<input type="text" name="search" size="20" maxlength="255"><br />

<input type="submit"style= "width:150;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.iarch.com/cgi-bin/search/smartsearch.cgi?keywords ';"> <br />

<input type="submit" style="width:150;text-align:center" value="Dmoz" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/odp.php ';"> <br />

<input type="submit"style="width:150;text-align:center" value="PPC listings"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.iarch.com/cgi-bin/ppc/search/smartsearch.cgi?keywords ';"> <br />

<input type="submit"style="width:150;text-align:center" value="Amazon"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.ther.com/cgi-bin//us.cgi?locale=us&mode=blended&input_string ';"> <br />

</form>  
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
the other pproblem is that the normal search comes up

us&input_string=river&mode=blended


and i've had to change it to

us&mode=blended&input_string=river

to make it 'work'
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
you can try changing the form from "get" to "post" ...
the default behavior for get is to encode those characters on the query string, so it would have to be done at the cgi.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Author Comment

by:macuser777
Comment Utility
Ok - by just changing the get to post the other 3 stay working and the query string in the last stays intact...but it does a blank search

maybe it's not coded right - here's the actual code --- if you post an answer PLEASE change the url's so the domains don't get spidered by google on this page

When you get to the amazon search you can type in any query to see how the url normally appears

===========
<form method="post">
<input type="hidden" name="keywords">

<input type="hidden" name="locale=us&mode=blended&input_string">

<input type="text" name="search" size="20" maxlength="255"><br />

<input type="submit"style= "width:150;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.i   ~~~~~ pure ~~~~~ search.com/cgi-bin/search/smartsearch.cgi?keywords ';"> <br />

<input type="submit"style="width:150;text-align:center" value="PPC listings"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.i   ~~~~~   pures  ~~~~~~ search.com/cgi-bin/ppc/search/smartsearch.cgi?keywords ';"> <br />

<input type="submit"style="width:150;text-align:center" value="Amazon"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.the~~~~~easy   ~~~~  river.com/cgi-bin//us.cgi?locale=us&mode=blended&input_string ';"> <br />

</form>  
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
some progress...

I can stop the code rewriting by splitting up the query, but the problem now is with the form names. The last serach would work if I could get the &search= out of the url. I've tried taking out 'search' completely and replacing with input_string throughout but that disables the second search???

It's no better using post instead of get.

<form method="get">  
 <input type="hidden" name="keywords">  
 
 <input type="hidden" name="locale" value="us">  
 <input type="hidden" name="mode" value="blended">  
 <input type="hidden" name="input_string">  
 <input type="text" name="search" size="20" maxlength="255"><br />  
 
 <input type="submit"style= "width:150;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.isearch.com/cgi-bin/search/smartsearch.cgi?keywords ';"> <br />  
 
 <input type="submit"style="width:150;text-align:center" value="DMOZ"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.isearch.com/odp.php ';"> <br />  
 
 <input type="submit"style="width:150;text-align:center" value="PPC listings"onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.isearch.com/cgi-bin/ppc/search/smartsearch.cgi?keywords ';"> <br />  
 
 <input type="submit"style="width:150;text-align:center" value="Amazon"onclick="this.form.keywords.value = this.form.input_string.value; this.form.action = ' http://www.theeasyriver.com/cgi-bin/us.cgi? ';"> <br />  
 
 </form>
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Hi knightEknight.

I've solved this by changing the search form name in the php search.

Please tell me how you'd like to close this q up.

Thanks for the input

macuser                    
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
post a comment for admin to refund your points.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
Comment Utility
Closed, 150 points refunded.
CetusMOD
Community Support Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Column Spacing 3 33
Animate a Title 7 33
lastpass auto fill login form 5 21
Fixing my modal from bootstrap 18 6
Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now