spaz
spaz

Reputation: 145

Link URL gets cut off after special character

I have a button on my home page. The link contains a question mark example

  http://url.com/my_app/#/store/items?page=2

this is the code for my button

<form action="http://url.com/my_app/#/store/items?page=2" method="get">
    <input type="submit" value="Click here">
</form>

The link doesn't take you to the correct site. The URL is cut off after the "?" like so

http://url.com/my_app/#/store/items

I tried to use ascii encoding but it still fails the same

<form action="http://url.com/my_app/#/store/items%3Fpage=2" accept-charset="UTF-8">
    <input type="submit" value="Click here">
</form>

To me it looks like the question mark is a special character and needs to be escaped but I haven't seen a similar question online.

Does anyone know why the URL is being cut off?

Upvotes: 0

Views: 2073

Answers (1)

JCOC611
JCOC611

Reputation: 19729

Hidden inputs can be used to send additional information that you want to process along with the form information. This should fix the issue:

<form action="http://url.com/my_app/#/store/items" method="get">
   <input type="hidden" name="page" value="2"/>
   <input type="submit" value="Click here">
</form>

Upvotes: 1

Related Questions