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

Neil Kennedy
Neil Kennedy
2,957 Points

PHP, jQuery and Ajax login and registration system

I'm currently building a website using Bootstrap for users to track their diet and exercise. As part of this I want to implement a registration system in which a user can register and login and be presented with their past results.

I'm thinking about a fairly simple system in which the user will login and be able to click a button and send their data to a database through jQuery, AJAX and PHP. This information can then be found the next time the user logs in.

I'm fairly good with jQuery and Ajax but not so much with PHP. Could anyone point me towards a simple written or video tutorial for this? Or even give me an idea of how I could achieve this?

Many Thanks

1 Answer

Maximillian Fox
PLUS
Maximillian Fox
Courses Plus Student 9,236 Points

Check out the Build a Basic PHP Website course and the PHP Basics. That will show you how to implement server side code into your contact forms, then you can use it with AJAX. A login form is different sure, but it uses similar principles. You'll also want to look into Object Oriented PHP to be able to understand the next part - databases in PHP.

You will need to be able to work with databases to store your users' information. Check out Database Foundations and PHP Databases with PDO.

One thing to note though is you don't have to use PHP and MySQL. For example, if you want to use Mongo, there's a course for that too which uses a lot of JS knowledge that you've accumulated. You can then call Mongo as an object in the server side language of your choice and run your queries from that. Heck you could even use node.js and have everything in a language you are already familiar with. Build a MEAN stack application! :)