I have a simple form in which I have 3 hidden fields, through which I am passing values to another page.
But I don't want anyone to see it through view page source or Fire Bug. I am working with PHP.
<form action=" " method="post" name="push">
<input type="hidden" name="publisherid" value="createcoolapps"/>
<input type="hidden" name="username"value="buzzmo"/>
<input type="hidden" name="pass" value="Javea0615"/>
<select name="appid">
<option value="QRScanner">app1</option>
<option value="app2">app2</option>
<option value="app3">app3 </option>
<option value="app4">app4</option>
</select >
<input type="hidden" name="topics" value=" "/>
Notification Message:<br />
<textarea style="width:10; height:10;" name="pushmessage"></textarea><br/>
<input type="submit" value="Push"/>
</form>
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, $_SESSION
is 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.