I want to encode an email id in a text box. An email id is saved in database. When page loads i retrieve email id from database using php and display in text input and when i see the email id in page source then the email id should be encoded. How to do this using php and html?
Asked
Active
Viewed 179 times
0
-
2What do you mean with "encoded" ? Please elaborate. – Ghigo Feb 27 '13 at 13:59
1 Answers
0
Try this:
function encode_email($e) {
$output = '';
for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
return $output;
}
echo(encode_email('email@in.com'));

Engineer
- 5,911
- 4
- 31
- 58
-
-
Thanks for your reply . I have tried with the same encoding method only. But in page source the text input is displaying as and in UI text input its displaying as ss@dd.com and not displaying actual email-id in UI text input. How to solve this problem? – Sandeep Prabhu Feb 28 '13 at 04:03