I have a simple PHP-HTML-CSS contact form which saves emails to a local email client's database (in my case, Roundcube's database, which is a standalone MySQL database, I think --- I haven't used the program yet). The data this simple form gathers is very trivial, things like name, email, phone number, etc. no sensitive data such as state ID number, bank account details, credit details, passwords etc. ; the form data is sent to me by PHP's mail()
function.
With the years I have learned that saving emails on a local database (for example, the same database on which a website is being hosted) can be dangerous due to an attack named "database injection" (such as "SQL injection").
Is there a standard way to backendly prevent database injections on simple web forms?
What should one ensure not to do, or to do indeed, with a backend language so that after a form is submitted, it wouldn't reach the local email client's if it included even the simplest sentence in any common querying language?
I am not asking for any code example, instead HTML-PHP I could ask about, I don't know, XML-Node.JS (?) ; I ask about standard principles.