M
M
Mick Jagger2016-01-29 16:04:08
PHP
Mick Jagger, 2016-01-29 16:04:08

How to add Rest API to a simple HTML form with its PHP handler?

There is a simple HTML form and its PHP handler, the data is sent via AJAX. When sending, you just need to check the validity of the entered data.
https://github.com/MikeBrickman/check-billing-info...
The problem is that the first requirement for the task is Rest API and the second one is CSRF prevention.
This is the first time I've come across this and I don't understand how to implement it in this too simple task.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2016-01-29
@Max_Dyachuk

Most modern frameworks have this out of the box. If the project is at the development stage, I would do it on the basis of a framework, for example yii2, and not reinvent the wheel. There is both CSRF validation and form validation and it is possible to use REST

A
Andrey, 2016-01-29
@VladimirAndreev

and what's the problem then?
it is necessary to implement the interaction of the form (in js) and the server (in php) in accordance with Rest (get receipt, post creation, etc.)
and tie CSRF to the form.

M
Mick Jagger, 2016-01-29
@Max_Dyachuk

Also what means "CSRF to the form to fasten"?
Can you explain at least how to use this rest? Here
https://github.com/MikeBrickman/check-billing-info...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question