Modify a URL in a sumit without losing the page_id Wordpress

1

I have a website and in it some functions that collect some data and then send them to a URL with a submit, the html is the following:

<span class="nearest"; style="color: white; font-size:15px; font-weight: bold">
  <form action="http://example.com/?page_id=262" method="post">
    <input type="submit" value="Solicitar" name="Submit" id="frm1_submit" class="btn btn-primary "style="font-size: 14px; font-weight: bold">
  </form>
</span>
<br>

As it is Wordpress, I would like all the content to be sent to a contact form on the page link . That's why I need that when people click on "Request", the submit forwards to another URL that should look like this:

http://example.com/?page_id=262&5value1=precio&5value2=ciudad

However, it looks like this:

http://example.com/?5value1=precio&5value2=ciudad.

I mean, I'm missing the page_id = 262 &.

Do you have any idea how to solve this?

    
asked by Alejo Calderón 06.01.2017 в 03:43
source

1 answer

1

You're losing page_id=262& because this part of the original URL is a GET variable. In order to re-create the request with the same parameter, you must include a hidden INPUT tag:

<input type="hidden" value="262" name="page_id">

Place it immediately after the <form ... > tag to get the URL you want.

    
answered by 06.01.2017 / 04:01
source