s22 Tech

Useful code.

Sending Data from an HTML Form to a PHP Script
(and remain on the same page)

If you don't know yet, you'll soon find out that JavaScript and PHP don't play nice with each other. Trying to send information from one to another can be an exercise in futility.

However, this script shows how it can be done using JavaScript's fetch() command. It allows you to send HTML form variables to a PHP script using JavaScript, and then display that info in a "result" div without having to reload the entire page.

This script is offered 'as-is' and is unsupported.



<‍/script>  

You can test it here.

Further reading: