Skip to content Skip to sidebar Skip to footer

How Do You Build A Link With A Form?

For the sake of simplicity let's say I have a 3 field HTML form, and after the user completes the form and submits, it builds a special link and sends the browser to it. Field A (T

Solution 1:

action and method properties in form.

<form action="YOUR_URL" method="get">
<input type="text"id="a" name="a" />
<select id="b" name="b"><option value="2">2</option></select>
<input type="text"id="c" name="c" />
<input type="submit" />
</form>

Solution 2:

You should use HTML Form Get Method, because:

if a form is sent using this method the data sent to the server is appended to the URL

<form method="get" action="myurl.com">
     <intput type="text" name="a"/>
     <inputtype="text" name="b" />
     <inputtype="text" name="c" />
     <inputtype="submit" />
 </form>

More about the method attribute you can find here, most important is:

  1. post: Corresponds to the HTTP POST method ; form data are included in the body of the form and sent to the server. get: Corresponds to the
  2. HTTP GET method; form data are appended to the action attribute URL with a '?' as separator, and the resulting URL is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.

Post a Comment for "How Do You Build A Link With A Form?"