0

I'm encoding URL's using javascript's encodeURIComponent() function when a form is submitted:

  <form name="form" action="actions.php" method="post">

      <input type="text" name="url" id="url" value="http://">

      <script type="text/javascript">

        function encodeLinks(){
            var e = document.getElementById('url')
            e.value = encodeURIComponent(e.value);        
        }  

      </script>

        <button type="submit" class="btn btn-primary" onclick="encodeLinks()">Submit</button>
    </form>

What is the most efficient way to get that data back into javascript on the actions page in order to decode it and then use it in a mysql query?

2
  • 1
    urldecode is it this what u looking? Commented Jan 11, 2013 at 4:06
  • Why do you need to do this? When you submit a form, the inputs are encoded automatically. Commented Jan 11, 2013 at 4:29

1 Answer 1

1

It is pointless to do this. The browser will automatically encode the data you are sending, and the server will automatically decode it. Everything is transparent, so you do not need to worry about it at all.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.