david sözke
david sözke

Reputation: 9

How can I hide the value from a input, so that the value is still accesable but won't be displayed?

I have a simple input form from the type submit and it contains the value $username:

<form action="index.php" method="POST">
     <input class="submit" type="submit" name="submitbtn" value="'.$username.'">
</form>

How can I hide the value, so that it will not be displayed on index.php, but I still can access this value?

Upvotes: 0

Views: 774

Answers (1)

mx0
mx0

Reputation: 7143

To hide fields in form from displaying change their type to hidden. Keep in mind that hidden field is just not displayed but anyone can read it/change it with browser devtools.

<form action="index.php" method="POST">
     <input type="hidden" name="user_name" value="'.$username.'">
     <input class="submit" type="submit" name="submitbtn" value="Submit">
</form>

Upvotes: 1

Related Questions