Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Paul Murphy
Paul Murphy
6,162 Points

Search Form and Google site search

Hi Guys,

I can't seem to get this to display results. It goes to the right page but it does not display any results.

                <form class="group"     id="searchbox_007920249510402107771:vklelu7qtb0" action="results.html">
                <input value="007920249510402107771:vklelu7qtb0"     name="cx" type="hidden"/>
                    <input value="FORID:11" name="cof" type="hidden"/>
                    <input type="text" name="s" style="width:220px;"id="s"     value="search..." onfocus="if(this.value==this.defaultValue)this.value='';"     onblur="if(this.value=='')this.value=this.defaultValue;"/>
                <input value="Go" name="sa" type="submit"/>
                </form>

Can you display your form handling code? This only displays the input form.

There's a couple of things I would look into:

  1. The first is that forms are usually handled by php, and action file you're referencing is an html file. If it actually has the php on it that you need to use you need to change the file to results.php.
  2. You also need to specify a method action on the form, i.e. method="post".

If you want more info about this the tutorial on building a php application here at TreeHouse is pretty good. There's a section that deals with contact forms.

Hope this was somewhat helpful.

1 Answer

Can you display your form handling code? This only displays the input form.

Paul Murphy
Paul Murphy
6,162 Points

Perhaps this is where I am going wrong as that is all I have. Are there any sites you can point me to where I can look into this?