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



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.