-3

I am wondering how to create a Base64 encoder with a form?

Like those websites which you input your text in a text box, press encode button, and the encoded text appears in another text box.

Thanks.

Alex
  • 1

1 Answers1

1

page.html

<form action="action.php" method="post">
 <p>String to base64 encode: <input type="text" name="string" /></p>
 <p><input type="submit" /></p>
</form>

action.php

$string = isset($_POST['string']) ? $_POST['string'] : "";
echo base64_encode($string);
Pedro Lobito
  • 75,541
  • 25
  • 200
  • 222