|
How do I add a Drugstore.com search to my Web site?I really like the Google search box you demonstrate on this site, but I want to add a search box on my site for Drugstore.com, and can't figure out how to do it. I thought I had it all working, but it's not. Can you help me out? I'll be forever in your debt! Forever's a long time, but let's have a stab at reverse engineering the Drugstore.com search that's on its site and trimming it down to its essentials. The first step is to do a "View Source" (usually View --> View Source). In that huge tangle of code we find: <form name="FRM_SEARCH" method="get" action="/search/search.asp" style="margin:0;padding:0;"><input type="hidden" name="searchtype" value="1"><input type="hidden" name="trx" value="28198"><input type="hidden" name="trxp1" value="60"><input type="hidden" name="ipp" value="20"><input type="hidden" name="srchtree" value="1"><input class="xsmall" type="text" size=24 maxlength=50 name="search" value="" style="height:19px;"></td><td valign="middle" style="border-bottom:1px solid #999999;padding-left:2;"><input name="Go" type="image" src="http://a1624.g.akamai.net/.../nav_go_button.gif" vspace=0 hspace=5 alt="Go" border=0></form>
Ugh, ugh. As a first step, I'll go ahead and add returns so we can see what's what: <form name="FRM_SEARCH" method="get" action="/search/search.asp"
style="margin:0;padding:0;"> <input type="hidden" name="searchtype" value="1"> <input type="hidden" name="trx" value="28198"> <input type="hidden" name="trxp1" value="60"> <input type="hidden" name="ipp" value="20"> <input type="hidden" name="srchtree" value="1"> <input class="xsmall" type="text" size=24 maxlength=50 name="search" value="" style="height:19px;"> </td> <td valign="middle" style="border-bottom:1px solid #999999;padding-left:2;"> <input name="Go" type="image" src="http://a1624.g.akamai.net/.../nav_go_button.gif" vspace=0 hspace=5 alt="Go" border=0> </form> It sure looks to me like we can dump some of these variables, and we can certainly lose the formatting table tags "td" and convert the img submit into a regular submit button, for simplicity sake. Also note the form value action: you need to normalize that to point to the Drugstore.com server, so I'll do that too. A little bit of experimentation reveals that all of the hidden variables are unnecessary (I simply added an 'x' before the word input on each of them in my test file, so they looked like <xinput type=... and found that the form still worked just dandy from my austere test page) so here's my minimalist Drugstore.com search box: <form method="get" action="http://www.drugstore.com/search/search.asp">
Search Drugstore.com: <input type="text" size=24 name="search" /> <input type="submit" value="Go" /> </form> Now you can go back and add fancy formatting and styles if you'd like, but the raw search should work just fine exactly as shown above. Here, test it: Search for, oh, I dunno, "vitamins" or "combs" to see how it works out.
Categorized:
CGI Scripts and Web Site Programming
(Article 6868,
Written by Dave Taylor)
Tagged: drugstore.com, search engines, web page scripting Previous: How do I create a new MySpace group? Next: Why has my LinkedIn Account been suspended? Subscribe!
Rather amazingly, there are no comments on this article yet.
I have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |