-
Need PHP help
Hello Everyone,
I’m new to PHP and am stuck on a problem. Might be my lack of knowledge of PHP, or might be a logic problem I’m not solving…
I am creating a gallery for people to order prints of images from. Each image has pull-down selector to enable visitors to order from 0-10 of 4 different sizes of print. So there would be 4 variables which need to be passed for each image.
This works just fine when I type everything but I’m using my newfound PHP knowledge to use a “for” loop to create the layout for each image – the thumbnail and 4 pulldowns for each size. I have the html which creates the layout loop up to the number of images in the gallery.
This part is great – I can instantly have the thumbnails and pull-downs set for lots of images… however, since the “select” tags are buried in the for loop, the variable name is exactly the same for each image – say a 5×7 has the variable name “$5x7_1” – it now has the same name for pictures 2 and up as well.
Is there a way to increment the _1 part of the name within the for loop? So that the 2nd image’s variable would be “$5x7_2” and so on? I’ve tried writing the name as “$5x7_$rownumber but this doesn’t work within the for loop.
Or is there some better way I’m missing? I can’t figure out how to do this with an array either.
here’s a url if it helps – please ignore the disasterous HTML, I’m just trying to get the script working before I redo the whole thing w/CSS…
https://www.seebigbelly.com/gallerybeta.php
Thanks!
Phil