dazz_club Posted November 7, 2013 Share Posted November 7, 2013 Hi there, I'm working on a photograph order form. The idea is to let the user select what photographs they want, proceed to the next page where they select the sizes and then on the last page complete their order with their details...(still working on this part) You can see a quick demo here http://flexdanceinc.co.uk/order/ on the last page (if you go through the stages of choosing a photograph and size) you will see that the size's selected don't really match up to the correct photograph.. Here is a screen shot of what I mean I've made the scripts available too.. I think I can understand what's going wrong or what's happening..it's displaying only the sizes that have been selected which makes sense but when it presents it on the next page (as seen above) it's not in the correct place, under the photograph it's meant to be... What am I doing wrong.. Thanks size.phpfinal.phpindex.php Quote Link to comment https://forums.phpfreaks.com/topic/283674-displaying-checkbox-data-correctly-maybe-wrong-loop-or-something-else-bad-use-of-array/ Share on other sites More sharing options...
QuickOldCar Posted November 7, 2013 Share Posted November 7, 2013 It appears you resolved your problem Quote Link to comment https://forums.phpfreaks.com/topic/283674-displaying-checkbox-data-correctly-maybe-wrong-loop-or-something-else-bad-use-of-array/#findComment-1457320 Share on other sites More sharing options...
dazz_club Posted November 7, 2013 Author Share Posted November 7, 2013 Hi, thanks for you post...I don't think I've sold it, just pointed out how it currently works, not how I would like it to work... If you take a look at the image embedded, the sizes don't match the photograph, because obviously it only shows what sizes have been selected.. How do i got the sizes to be in the right position... Here's the code the produces the image about $how_many = count($photographs); //echo $how_many; echo '<p><strong>Quantity chosen:</strong> <em>'.$how_many.'</em></p>'. "\n"; if ($how_many>0) { echo '<p>You chose the following photograph/s: <strong>Now please select the size/s you would like</strong></p>'. "\n"; } echo '<ul class="basic_gallery">'. "\n"; for ($i=0; $i<$how_many; $i++) { echo '<li><a href="" ><img src="../order/photo/'.$photographs[$i].'" /></a>'. "\n"; echo '<input type="text" name="photographs[]" value = "'.$photographs[$i].'" />'; echo "<div id='options'> ". "\n"; echo "<ul> <li><label>" . ($i+1) . '- ' . $photographs[$i] ."</label></li> </ul> ". "\n"; echo '<ul class="photograph_size">'; echo "<li><h4>Selected Sizes:</h4></li>"; echo '<li>'.$large[$i].'</li>'; echo '<li>'.$small[$i]. '</li>'; echo "</ul> </div> </li>". "\n"; } echo "</ul>". "\n"; If you share your wisdom with me, I'll be grateful or point out where I;m going wrong and I can have a go.. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/283674-displaying-checkbox-data-correctly-maybe-wrong-loop-or-something-else-bad-use-of-array/#findComment-1457345 Share on other sites More sharing options...
dazz_club Posted November 8, 2013 Author Share Posted November 8, 2013 I think, after digging around..is that I need to use a multidimensional array.. The problem I've got is that the image sizes that have been selected don't match or file under the same image (when it's displayed to the user)..so I'm looking at using a multidimensional associative array..? Because each image selected (chosen by the user) comes with an option of having a large or small size or both... so I'm looking at something like this; $photograph_selected = array( 'Name of photograph' => $photograph_name, 'Large Size Selected' => $large, 'Smal Size Selected' => $small ); So now it's just a case how constructing the code and putting it where it seems fit... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/283674-displaying-checkbox-data-correctly-maybe-wrong-loop-or-something-else-bad-use-of-array/#findComment-1457472 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.