Link with values ​​from inputs

Good day to all.

There is a page with several inputs (name1, name2, name3…), in which the user writes values, such as “123”. It is required to add several links to different pages from below (page1, page2, page3…) so that the values ​​of the inputs are added to the pages at the end. In layman’s terms:


building a form is not suitable, because links not to one, but to different pages.

Help me figure it out.

Answer 1, authority 100%

How about Yandex? =)

$('input.word').keyup = function(){
    var str = '?';
    $('input.word').each(function(){str += '&''='+this.value});
    $('').each(function(){this.href = this.href.split('php')[0] + 'php' + str;});

input.word – inputs into which values ​​are written – changeable links
And yes, you need jQuery.

Answer 2, authority 100%

<a href='page1.php' id='page1'>page1</a>
<script type='text/javascript'>
var href = "page1.php?";
  href += $(this).attr('name')+"="+$(this).val();
window.location = href;

Answer 3

Enter multiple shapes:

<form action="page1" name="name1" method="post"><input name="name1"></form>
<form action="page2" name="name2 method="post""><input name="name2"></form>
<form action="page3" name="name3 method="post""><input name="name3"></form>

PS why are you sure that the user will enter “123” and not some crap like sql-injection?