Need to have dynamic hidden field
<p>I have script which allows the user to choose an image and write something about it...they choose the image from a JQuery slideviewer. </p>

<p>Now, choosing the image is easy..but how can I take the chosen image with the other form data? Each image is currently in a LI element</p>

<p>Code snippet:</p>

<pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="/js/jquery.easing.1.3.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="/js/jquery.slideviewer.1.2.js" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p><strong>UPDATE</strong> I have now added this as suggested below but still not working:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$( "#wl_add" ).submit( function ( event ) {

$( this ).find( "input[name='item_pic_url']" )
.val( $( "#mygalthree img" ).attr( 'src' ) );

} );
&lt;/script&gt;

&lt;div id="mygalthree" class="svw"&gt;&lt;ul&gt;
&lt;?PHP

foreach($html-&gt;find('img') as $e){ // from simple_html_dom

$image = $e-&gt;src;

echo '&lt;li&gt;&lt;img src="'.$image.'" width=300 alt="" /&gt;&lt;/li&gt;';
echo '&lt;input type="hidden" name="item_pic_url" value="'.$image.'" /&gt;';

?&gt;

&lt;/ul&gt;&lt;/div&gt;
</code></pre>

<p>The hidden field in there now currently stores the last image added to the UL</p>

<p>Is there someoway to make a hidden field dynamic and then be changed depending on the image chosen - ideally i need the img src in the hidden field</p>
