0

For example; if a user clicks pop and rock boxes i want to send the page to www.mysite.com/?view=listen&tag[]=pop&tag[]=rock
If i use form code below it works on Firefox and IE fine. But if user clicks with Google Chrome, page goes to http://www.mysite.com/www.mysite.com/?view=listen&tag[0]pop&tag[1]rock& equal signs in front of tag names disappear. How can i get worked on google Chrome too?

<form action="http://www.mysite.com/">
    <input type="hidden" name="view" value="listen" />
    <input type="checkbox" name="tag[]" value="pop" />pop<br /><br />
    <input type="checkbox" name="tag[]" value="rock" />rock<br /><br />
    <input type="checkbox" name="tag[]" value="indie" />indie<br /><br />
    <input type="checkbox" name="tag[]" value="electronic" />electronic<br />
    <button type="submit">submit</button>
</form>

1 Answer 1

1

I tried this. In google chrome, it does post the form to correct url with square brackets and equal sign:

Here is your code:

Form URL: http://jsbin.com/ihagon/1

When I select pop and rock and press submit, it goes to this url:

Target URL: http://jsbin.com/ihagon/1?view=listen&tag%5B%5D=pop&tag%5B%5D=rock

Here's the HTML code:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
</head>
<body>
  <form action="http://jsbin.com/ihagon/1">
    <input type="hidden" name="view" value="listen" />
    <input type="checkbox" name="tag[]" value="pop" />pop<br /><br />
    <input type="checkbox" name="tag[]" value="rock" />rock<br /><br />
    <input type="checkbox" name="tag[]" value="indie" />indie<br /><br />
    <input type="checkbox" name="tag[]" value="electronic" />electronic<br />
    <button type="submit">submit</button>
</form>
</body>
</html>

Let me know if I am missing something.

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

1 Comment

I have realised that i left open a useless javascript function. So this is the problem's source.

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.