Not able to tell from what you've submitted, but there are two main routes to what you wish to do:
HTML <<form>> where you set your php procedure for database access as the target of
action=
AJAX - a javaScript call to a php file that does your job, and
possibly updates your screen, as well.
To get your started, should these be 'alien' concepts, I would point you to:
Forms[
^]
AJAX[
^]