Picture a 5 page gallery of images, each page with about 20 images on it. Each image is associated with 2 checkboxes, "web resolution" and "print resolution" for clients to order a digital copy of the image.
The page is built in PHP. When the client is finished selecting images across all 5 pages, she clicks "Submit Order" and is taken to a confirmation page that will display thumbnails of the selected images and ask for order and budget information.
What is the easiest way to retain which images have been selected across the pages? When this was a one page gallery, I was using this code which worked perfectly:
echo "<ul class=\"req-box nolist\">
<li>";
if (isset($_POST['photo-select']) && in_array($photoid . "-print", $_POST['photo-select'])) {
echo "<input type=\"checkbox\" checked=\"checked\" name=\"photo-select[]\" id=\"{$photoid}-print\" value=\"{$photoid}-print\" />\n";
} else {
echo "<input type=\"checkbox\" name=\"photo-select[]\" id=\"{$photoid}-print\" value=\"{$photoid}-print\" />\n";
}
echo "<label for=\"{$photoid}-print\">print use</label></li>\n
<li>";
if (isset($_POST['photo-select']) && in_array($photoid . "-web", $_POST['photo-select'])) {
echo "<input type=\"checkbox\" checked=\"checked\" name=\"photo-select[]\" id=\"{$photoid}-web\" value=\"{$photoid}-web\" />\n";
} else {
echo "<input type=\"checkbox\" name=\"photo-select[]\" id=\"{$photoid}-web\" value=\"{$photoid}-web\" />\n";
}
echo "<label for=\"{$photoid}-web\">web use</label></li>\n
</ul>\n";
But now this obviously won't work, since the links to the pages are <a>
anchors and won't post to the $_POST array. I think this can be done using a jQuery AJAX POST event, but I'm not 100% sure, and I'm not sure if that's the best way to do it. If someone has JS disabled, the form won't work at all, right?
If that's the only way, then fine, but I need some advice from you all about that. Thanks!