P
P
Partizanka2252020-06-05 11:54:54
WordPress
Partizanka225, 2020-06-05 11:54:54

How to make a calculator for a website using an array?

Hello!
Help me figure it out and direct me in the right direction

We need to place a calculator on the wp website for calculating the cost of cargo transportation

Input data - cost of distance, weight of cargo

The cost of the distance looks like a data table like
Moscow St. Petersburg 1000
Moscow Kostroma 8000
Moscow Vladivostok 140000 St.
Petersburg Tver 5000
Yaroslavl Tambov 6000
Etc. .

Accordingly, the total cost must be calculated by multiplying the cost of the distance by the mass.

How can this be implemented?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-06-05
@azerphoenix

Well ... there are 2 options:
1) the calculator is implemented on js. The data is processed on the client.
2) the calculator is implemented in js and sends the data selected by the user to the server via ajax. The data is processed on the server and the result is returned to the client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question