How to hide values in hidden fields?

。_饼干妹妹 提交于 2019-11-29 13:02:14

You can't hide anything in HTML. If it's in the code, anyone can see it. If you need to pass values between pages and keep them hidden, then you need to use Sessions.

You can't. If you want to keep something secret from the visitor, don't give it to the visitor's browser.

Store the data on the server and send a token related to that data to the browser instead. Look the data up using the token when the browser submits it back.

You could use sessions for this (although beware of race conditions).

You cannot hide values of hidden form elements. You could encrypt it or try to protect other way, but it will be there.

As already said, $_SESSIONis the way to go.
If you can't, there ARE ways to protect hidden fields, with a certain amount of security.
The solution is
1. encoding the data and sending the encoded data and the hash,
2. validate if the data has been changed on the 2nd page and de-code it there.

If you are interested, leave a comment and I'll provide some examples.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!