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.



I am looking for a Course that goes over using Forms to Query a MySQL database. I see PHP courses and PHP with MySQL, but I presume I am not looking in the right places as I do not see a video that talks about how to use a form to do this.

I am aware of how to use php to query a database with fixed variables, but I want to learn how to use a form to do this.

Thanks in advance.

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

Elric, can you give a more specific example? For instance, are you trying to create a search function?

The broad answer to your question is that you set the form's method = post ( you could use get, I just perfer post). Then you can retrieve the form info from the $_POST variable and use it to query the database.

Thank you for the response. I am not looking for a text response on how to do a form post. I am curious, if there is a course video or set of videos that covers this so I can visually see the method and understand the concept. As I tend to learn better with visual instruction than reading.

Andrew Shook
Andrew Shook
31,709 Points

Somewhere in this course Randy discusses how to make a search box that will query the database and return result. Hope this helps.

Thank you for the assist, Andrew.