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

PHP

how to make search bar work ???

i dont know how to make search bar work ...... for example search for products from the website or go to the page of the product please help to to do it thanks

Hi , i dont know it but one of the best way to learn it is to go on youtube and search how to do it .

its pretty simple. have a search box on a page . post the value of the search box. poll the database based on the value and return an array with the results. Once you have the array just do a foreach around the array.

1 Answer

There's a couple of things you'll need to get this working. If you're looking for Treehouse to take you there this track from start to finish will do it!

<script type="text/javascript"> document.getElementById('frmSearch').onsubmit = function() { window.location = 'http://www.google.com/search?q=site:yoursite.com ' + document.getElementById('txtSearch').value; return false; } </script>

is this right i am felling lost don't know what to do please help thank you so much