How to hide echo "$password" form values?

Ok so I have a form where the username and password inputs are needed to be hidden

PHP Code:

[code]<?php
if($_POST[‘submit’])
{
$username = “Username”;
$password = “password”;
$link = “index.php”;

<-- More code not relevant to Q -->

?>

Blah blah blah

<?php } else { ?> <?php } ?>[/code]

That is what I currently have but obviously if someone was to view source they would be able to see the info which is a security risk so my Q is

How can I hide the values from source?

Note:PHP newbie so please post code example

As always thank you in advance

Hi there,

No PHP is viewable from the client. View the source yourself, all you will see is “Blah blah blah”. For php code to be viewable it will require the ‘echo’ or ‘print’ method.

He is outputting the data into the form - so it would be visible.

@Hayssam Unless the remote end (site your sending the form to) accepts an encrypted password, you can’t avoid sending it to the user.

Sponsor our Newsletter | Privacy Policy | Terms of Service