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 MySQL Forms
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.
Andrew Shook31,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.