Link to home
Start Free TrialLog in
Avatar of pdmstudios
pdmstudios

asked on

FOREACH PHP with accordion display question

I have a php file that grabs data from a database and returns rows of data. It's a shopping cart, and I need to have an expand and collapse on each of the tables in order to have minimal page space taken up, unless they expand each table. The table has the following data, and the data ranges in results. Right now, there are 11 tables that display with different results, and I need the main tables to be able to expand and collapse when the user clicks EXPAND or COLLAPSE. The tables have a table name, then 4 columns below with Qty, Image, Name, and Price below. I want Expand/collapse arrows on the left and right of the Table names. Please see the attached file for reference.

<![CDATA[
				<?php if ($option['type'] == 'multiple') { ?>
					<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
					  <table width="100%">
					    <tr style="background: #dddddd; line-height: 20px; font-weight: bold;">
							<td width="60px" style="text-align:center;"><?php echo $text_qty; ?></td>
							<td width="50px"><?php echo "Image:"; ?></td>
							<td style="text-align:center;"><?php echo $option['name']; ?>:</td>
							<td width="100px" style="text-align:center;"><?php echo $text_price; ?></td>
						</tr>
						<hr>
					  <?php foreach ($option['option_value'] as $option_value) { ?>
					  
					    <tr style="background: #eeeeee;">
						  <td style="text-align:center;"><input type="text" name="oquantity[<?php echo $option['product_option_id']; ?>][<?php echo $option_value['product_option_value_id']; ?>]" size="2" value="0" /></td>
						  <td style="text-align:center;"><?php if ($option_value['image']) { ?><a rel="colorbox" href="<?php echo $option_value['imagelarge']; ?>" class="colorbox" rel="colorbox"><img src="<?php echo $option_value['image']; ?>" /></a><?php } ?></td>
						  <td style="text-align:center;"><?php echo $option_value['name']; ?></td>
						  <td style="text-align:center;"><b><?php echo $option_value['price']; ?></b></td>

						</tr>
						
					  <?php } ?>
					  <hr>
					  <span style="font-weight:bold; text-align:center;"><?php echo $option['name']; ?> </span>
					 
					  </table>
					</div>
                <?php } ?>
			]]>

Open in new window

(edited to use the Code Snippet for the code. ~Ray)
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

and the exact/actual question is what, please?
ASKER CERTIFIED SOLUTION
Avatar of Justin Pilditch
Justin Pilditch
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial