+ Reply to Thread
Results 1 to 4 of 4

Thread: Form Code Question for Search Box

  1. #1
    Join Date
    Nov 2005
    Location
    Tampa Bay Area, Florida
    Posts
    1,073

    Default Form Code Question for Search Box

    Okay, I'm stumped. Here's what I have so far and it works just fine, searches ONLY "mysite" for keywords. But, I don't want the radio button or the text after it "Subdivisions". Just want the input box and the search button and of course to only search my site. Everytime I mess with the code, it stops searching only "mysite" and goes to google and gets everything. Can any of you coders out there help? Thanks so much!

    <form method="get" action="http://www.google.com/search">
    <input type="text" name="q" size="31" maxlength="155" value="" />
    <input type="submit" value="Search" />
    <input type="radio" name="sitesearch" value="mysite.com" checked /> Subdivisions<br />
    </form>

  2. #2
    Join Date
    Mar 2008
    Location
    Miami, FL
    Posts
    17

    Default Re: Form Code Question for Search Box

    change this line:

    <input type="radio" name="sitesearch" value="mysite.com" checked /> Subdivisions<br />

    to this:

    <input type="hidden" name="sitesearch" value="mysite.com" />
    SellFoN.com | Webinars & Tutorials
    Lead Generation and Marketing for Real Estate Professionals

  3. #3
    Join Date
    Nov 2005
    Location
    Tampa Bay Area, Florida
    Posts
    1,073

    Default Re: Form Code Question for Search Box

    Thank you! I had just about given up. Another question for you if you know and don't mind. Is there a way to get the search results to pop a new page so the user doesn't lose the original page?

    The only problem I have with this search is that google paid ads are there along with my results. But, it's still good for me to have this.

  4. #4
    Join Date
    Mar 2008
    Location
    Miami, FL
    Posts
    17

    Default Re: Form Code Question for Search Box

    this should do it. not sure if popup blockers will complain about the JavaScript window.open stuff (i don't use popup blockers, so please test this).

    Code:
    <script type="text/javascript">
    function doSearch()
    {
    	var frm = document.forms.search;
    	var q = escape( frm.q.value );
    	var site = frm.sitesearch.value;
    	var url = "http://www.google.com/search?q=" + q + "&sitesearch=" + site;
    	window.open( url );
    }
    </script>
    <form name="search">
    <input type="text" name="q" size="31" maxlength="155" value="" />
    <input type="button" onclick="doSearch()" value="Search" />
    <input type="hidden" name="sitesearch" value="mysite.com" />
    </form>
    SellFoN.com | Webinars & Tutorials
    Lead Generation and Marketing for Real Estate Professionals

+ Reply to Thread

Similar Threads

  1. simple form question
    By RESynergy in forum Coding
    Replies: 5
    Last Post: 06-04-2007, 11:11 AM
  2. Zip code, area code validation database....
    By tracedef in forum Coding
    Replies: 2
    Last Post: 04-17-2007, 08:26 PM
  3. PHP form problem
    By RESynergy in forum Coding
    Replies: 1
    Last Post: 02-22-2007, 09:41 PM
  4. The Million Dollar Question on Link Request Form Software
    By Bob Crain in forum Link Building
    Replies: 2
    Last Post: 08-09-2005, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts