Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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?