OK, There is a form in which you enter some numbers, mark something from a drop-down menu and then the page reloads sending all that data in POST. Then PHP makes some simple calculation and prints something on the screen. I do filter all the data so it doesn't contain any harmful code and then it calculates the answer using some formulas.
I want to use
JS instead of PHP because then, I would save server resources (not a lot, but anyway) and those calculations are simple enough that the JavaScript wouldn't run too slowly. Actually it should be nearly instant. So the question is
if it is safe to use JS to publish something on the website? I'm not going to save any of that data on my server, so it looks like it can't make any harm to the website, but I just want to be sure.
Example.
So I usually type some numebrs in the form:
90
14
3
and it makes some calculations using those three. Then it prints the answer:
4
So, I want to use
JS for this as it is very simple, but
JS is done in a browser and so anyone can edit the code, so it's totally unsecured against publishing code on the website:
90
< b > test </ b >
3.
During the calculations it may print some errors as the input is not a number, but anyway.
P.S. I just wonder if
JS can make any harm to the website. I mean should I still use PHP or is
JS OK?
------Edited------
Delete this thread, found out about such thing as innerText