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


Steven Fullerton
Steven Fullerton
6,712 Points

Adding search to shirts for mike (PHP)

Hi folks,

I've been through building a simple PHP app videos, and now im wondering if it would be possible to integrate some sort of search. For example, the colour of each T-shirt is stored within the array. I would like to be able to say search for 'green' T-shirts or press a button which said green, and have the PHP look through the array and display any T-shirts which match that condition.

ANy suggestions of how i could do this? or any recommended tutorials/reading?


6 Answers

Charlie Thomas
Charlie Thomas
40,856 Points

It's covered in the upcoming tutorial: Enhancing A Simple PHP Application. The search content is due on the 25th April

Randy Hoyt
Randy Hoyt
Treehouse Guest Teacher

Hey Steven,

I'll be covering that in an upcoming set of videos. :~) (We just launched the second PHP project, and you can see the upcoming stages on the Roadmap.)

Here's a preview:

  • Create a new search.php page.
  • Put a simple form on that page (text box and a button).
  • Just like the contact.php page, that form should submit to the same page it is on.
  • If you have a form submission, use a foreach loop to go through each shirt ...
  • ... and check if the shirt has the search term in it using the strpos function.

Stay tuned! :~)

Steven Fullerton
Steven Fullerton
6,712 Points

Awesome, cant wait for the video! Is there anything anyone would recommend looking at between now and April?

James Barnett
James Barnett
39,199 Points

@Steven - Check out these 2 courses from the good people at Lynda.com