I'm having a problem retaining $_POST variables on refresh. I have a page that contains numerous photos, each with a checkbox. When the checkbox is checked, a div opens with various sizes for photo prints. There is a select menu that accompanies each size print, and the user can select 1–10 prints. The user selects the desired photos and number of prints at each size, and submits the form.
Then, a do/while loop is used to output all of the selected prints/quantities (think of this as a "review your selections" type of page). This works perfectly using the following code:
To give you a better idea of what is going on there, this is an example of an input field for a photo (this is part of the form that is passed over from the previous page):PHP Code:
$varHolder = $row_photo_rs['photo_id'];
$var4x6 = $_POST["$varHolder-4x6"];
$var5x7 = $_POST["$varHolder-5x7"];
$var8x10 = $_POST["$varHolder-8x10"];
$var8x12 = $_POST["$varHolder-8x12"];
$var11x14 = $_POST["$varHolder-11x14"];
$var12x18 = $_POST["$varHolder-12x18"];
$var16x20 = $_POST["$varHolder-16x20"];
$var20x30 = $_POST["$varHolder-20x30"];
$varWallet = $_POST["$varHolder-wallet"];
} while .......
Notice that that the "name" field for the select box is the photo_id, and then "-4x6." This same thing happens for the other various sizes (as you'll notice in the variable definitions above). So the loop goes through the photo_id's and determines how many of each photo is ordered at each size. Once the loop finishes with the first photo_id, it loops to the next one, resetting the value for $varHolder, and all of the other variables, in the process. This, in turn, changes the quantity of each size for that specific photo.Code:<select name="<?php echo $row_photo_rs['photo_id']; ?>-4x6"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select>
Again, this all works fine, but if a refresh happens, it's all lost. How do I retain everything in the output even during refresh? It's not part of a form, but simply output to the screen. I've looked at some similar questions, and it seems like maybe an array of some type is the answer, but I couldn't make sense of what to do in relation to my exact problem. Would it be a multi-dimensional array? Any help would be greatly appreciated.