Jump to content

Displaying checkbox data correctly | Maybe wrong loop or something else | Bad use of Array?


dazz_club
 Share

Recommended Posts

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 order-final.png

 

 

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

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.