Advertisement
lalatino

url_encode-decode test

Jul 15th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.  
  6. <script type="text/javascript">
  7.  
  8. function test() {
  9.     document.forms.form.str.value = encodeURI(document.forms.form.str.value);
  10.     alert(document.forms.form.str.value);
  11.     return true;
  12. }
  13. </script>
  14. </head>
  15. <body>
  16.  
  17. <?php
  18. if (!empty($_POST)) {
  19.     var_export($_POST);
  20.     echo '<br/> decoded = ';
  21.     echo urldecode($_POST['str']);
  22. }
  23. ?>
  24.  
  25. <form action="" name="form" method="post" onsubmit="test()">
  26. <input type="text" name="str" value="Фамилия, Имя skúška ståle">
  27. <input type="submit" name="send" value="Send">
  28. </form>
  29.  
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement