Rely on javascript to execute PHP script or manipulate hidden form elements and rely on PHP?
<p>I wrote a JavaScript script that swaps two selected <code>img</code> tag <code>src</code> values.</p>

<p>The point is to let the user rearrange a list of images.</p>

<p>For sending the new order to a PHP script, I have two ideas:</p>

<ol>
<li><p>Have a button execute a JavaScript function that gathers the new order of images into an array of URLs. Then, rely on JavaScript to send the data to a PHP script?</p></li>
<li><p>Have the initial JavaScript rearrange <code>hidden</code> input tag <code>value</code> attributes which would contain data such as a URL and order number. Then, rely on a <code>submit</code> input button to execute a <code>POST</code> request without JavaScript?</p></li>
</ol>

<p>Thanks!</p>
