Send data from javascript to html and fetch with php <p>ok, i don't know if this is the proper way of doing this. If not, please give me an example on how to do it. How do i fetch the data in the JS and send it to html?</p> <p><strong>JS</strong></p> <pre><code>$(document).ready(function() { var choosenYear = $('#choose_year'); $("#choose_year").select2({ data: [{ id: 0, text: '2015' }, { id: 1, text: '2014' }], val: ["0"] }).select2('val', 0); // Start Change $(choosenYear).change(function() { var choosenYear = $(choosenYear).select2('data').id; $('#choosen_year').val(choosenYear); }); //Change }); </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;form class="form-inline well col-md-8" id="form-choose_usr" action="#" method="post" enctype="multipart/form-data"&gt; //This is what i POST &lt;div&gt; &lt;input type='hidden' class='col-md-4' id='choose_usr_email' name='choose_usr_email'&gt; &lt;/div&gt; &lt;!-- Select2 choose_year --&gt; &lt;div&gt; &lt;input type='hidden' class='col-md-2' id='choose_year' name='choose_year'&gt; &lt;/div&gt; &lt;!-- Select2 choose_month --&gt; &lt;div&gt; &lt;input type='hidden' id='choosen_year' name='choosen_year'&gt; &lt;input type="submit" class="btn btn-info pull-right" value="Hämta" /&gt; </code></pre> <p><strong>PHP</strong></p> <pre><code>//And this is how i fetch it $posted_choosen_year = $_POST['choosen_year']; echo $posted_choosen_year; </code></pre>