I have an array of image URLs saved from a form submission. I then give users the ability to edit the form values and sort their images using .sortable from jQueryUI. I take the sorted ID's and add them to a hidden input which adds them to the main POST data and into the saved array of form values.
Saved Form Data:
$dataArray(
[firstName] => Alex
[lastName] => Ander The Great
[imageorder] => image1,image3,image2,image4
)
$filesArray(
[image1] => url.png
[image2] => url2.png
[image3] => url3.png
[image4] => url4.png
)
$imageorder = explode(',', $dataArray['imageorder']);
/* Gives the following */
array(
[0] => image1
[1] => image3
[2] => image2
[3] => image4
)
What I need to do is to be able to get the following to order by the $imageorder var.
<?php foreach($filesArray as $image) { ?>
<img src="<?php /*echo the correct image url*/ ?>">
<?php } ?>