Is it possible to connect an html form with an online database website?

Is it possible to connect an html form with an online database website? I found the code below with the use of php but, my sql database is on a company website so, I cannot use localhost. Is there any other way to connect the html form with the url database? So, what I want to achieve is for customers to complete my form and then the data will be automatically updated in the database. Thank you in advance!

$con = mysqli_connect(“localhost”,”your_localhost_database_user”,”your_localhost_database_password”,”your_localhost_database_db”);