Here's a gallery page: http://www.metroscap.com/chicago-black-and-white-photos.php Here's a detail page: http://www.metroscap.com/chicago/1203/traffic-on-michigan-avenue-at-monroe.php
I'm attempting to submit the following data: (but this button will have about 15 varieties per page. Each of my photos has its own page. (see the detail page and the products in the accordion on the right side -- Each photo has about 25 different framed size options that i've built CSS classes for. I wish to be able to have people submit multiple framed sizes of multiple pictures to my rudimentary drag and drop wall so that they can compare photos and their framed size to one another.
so for example, someone could submit a 42" x 42" version of Columbus | "Leveled", and two 27" versions of Atlanta | "Atlanta" and Chicago | "Monroe" on a dark blue wall.)
Here is the button code i'm submitting or would wish to submit for each size/frame variety for each picture, here are two buttons.
<form action="http://localhost:8888/drag-drop-test2.php" method="post" style="width: 200px; height: 200px;">
<input type="hidden" name="widthHeightTotal" value="424" />
<input type="hidden" name="picture" value="http://www.metroscap.com/images/bigJPEGS/columbus/Leveled.jpg" />
<input type="hidden" name="ddClass" value="TPC42test" />
<input type="hidden" name="widthHeight" value="354" />
<input type="submit" value="Add to Wall" />
</form>
<form action="http://localhost:8888/drag-drop-test2.php" method="post" style="width: 200px; height: 200px;">
<input type="hidden" name="widthHeightTotal" value="324" />
<input type="hidden" name="picture" value="http://www.metroscap.com/images/bigJPEGS/columbus/Leveled.jpg" />
<input type="hidden" name="ddClass" value="TPC32test" />
<input type="hidden" name="widthHeight" value="300" />
<input type="submit" value="Add to Wall" />
</form>
now on the drag-drop-test2.php page i wish to simply use a foreach loop to ether print_r or echo through each framed size the user wished to drag around and compare on the wall with this echo statement
echo "<div class=\"drag\" style=\"left:20px; height: ".$widthHeightTotal."px;\"><img src=\"".$picture."\" class=\"".$ddClass."\" width=\"".$widthHeight."\" height=\"".$widthHeight."\" /></div>";
I can get this working if i'm only submitting one picture to the wall. I simply cannot wrap my brain around walking through the $_POST or $_SESSION array to make this behave the way i intend.
maybe php isn't my best solution for this, maybe it's jquery. i don't know for sure. i'm not necessarily a programmer or developer, but i know enough to be dangerous to myself, especially if it's a sharp $obj.
------------- UPDATED ----------- i've removed the brackets from the button code.
Ok, before posting here i've struggled with this for a week with the foreach statement. when i do exactly this (as suggested):
foreach ($_POST as $key => $value) {
$$key = $value;
echo "<div class=\"drag\" style=\"left:20px; height: ".$widthHeightTotal."px;\"><img src=\"".$picture."\" class=\"".$ddClass."\" width=\"".$widthHeight."\" height=\"".$widthHeight."\" /></div>";
}
Here is what's output:
<div class="drag" style="left:20px; height: 324px;"><img src="" class="" width="" height="" /></div>
<div class="drag" style="left:20px; height: 324px;"><img src="http://www.metroscap.com/images/bigJPEGS/columbus/Leveled.jpg" class="" width="" height="" /></div>
<div class="drag" style="left:20px; height: 324px;"><img src="http://www.metroscap.com/images/bigJPEGS/columbus/Leveled.jpg" class="TPC32test" width="" height="" /></div>
<div class="drag" style="left:20px; height: 324px;"><img src="http://www.metroscap.com/images/bigJPEGS/columbus/Leveled.jpg" class="TPC32test" width="300" height="300" /></div>
Four instances of the echo line, and only depositing one value per loop until the entire line is finally populated with the correct values by the fourth iteration. I simply don't understand the logic of what's happening here in the foreach. EVEN at this though, when i try to return to my button page and add a different item to the page, i don't get 8 items of two different things (four of each) i only get the one item.
If all I wanted was just one item on this page at one time i'd just have one echo line on the page and just make my echo line be:
echo "<div class=\"drag\" style=\"left:20px; height: ".$_POST['widthHeightTotal']."px;\"><img src=\"".$_POST['picture']."\" class=\"".$_POST['ddClass']."\" width=\"".$_POST['widthHeight']."\" height=\"".$_POST['widthHeight']."\" /></div>";
and not worry about putting that line in a foreach or do...while because i'd only ever want one item on the page.
what I want is to be able to have 35 (that's overkill but i overkill to make a point) differnent pictures end up on this page. and actually, ideally, at 35 different sizes.
i'm clearly dumber than i think i am apparently.