How to populate forms with data from a database in Drupal

Events happening in the community are now at Drupal community events on www.drupal.org.
vstarsal's picture

I have a form that a user will fill out, but they may need to return to the same form to update or add data. I have created a form with Drupal's own fields and a custom form that I coded in PHP. I prefer to use my custom form because of the way it is formatted, but if needed I can use Drupal's. I want to populate the form when the user enters the correct password. Can I use msqli in PHP or do I have to use Drupal's methods? If so, how do I get the data from the DB with Drupal?