V
V
VaaL20042018-11-19 13:55:54
JavaScript
VaaL2004, 2018-11-19 13:55:54

How to make auto-substitution of first and last name from the database?

Hello!

Faced the following problem. There is an internal website of the organization, which contains descriptions of projects, both current and archived. Projects have people who relate to them in one way or another. The so-called "contacts". This is a separate table of an approximate form:
name, surname, post, phone, organization_id

The essence of the task is as follows: the project needs to make a form for adding contacts in such a way that several contacts can be added, if such a contact exists in the database, then the form should offer to select this one person, if not, then the person must be added to the database (only name, surname is possible). And the button "Add another contact", which generates more of the same fields.

If this is the only input field that will contain both the first and last name, then how to determine in which order the user wrote: first name + last name or last name + first name? And avoid duplicate entries in the database (for example, Ivan Sidorov, Ivan Sidorov)?

If it will be two fields, then how should auto-substitution work in conditions when there are namesakes in the database?

How are things like this done right?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question