sheriff Posted April 11, 2007 Share Posted April 11, 2007 Hi all ! I have a list of products with price. How can I add to to every product a discount ? this is how the list are build <tr> <td align="center" bgcolor="<?php echo $row_color; ?>"><?php echo $id; ?> <td align="left" bgcolor="<?php echo $row_color; ?>"> <?php echo $name; ?></td> <td align="left" bgcolor="<?php echo $row_color; ?>"> <?php echo $desc; ?></td> <td align="center" bgcolor="<?php echo $row_color; ?>"><?php echo $um; ?></td> <td align="right" bgcolor="<?php echo $row_color; ?>"><?php echo $price; ?> RON </td> <td align="right" bgcolor="<?php echo $row_color; ?>"> <select name="discount[]"> <option value="" selected>---</option> <option value="3">3%</option> <option value="5">5%</option> <option value="7">7%</option> <option value="10">10%</option> </select></td> <td align="center" bgcolor="<?php echo $row_color; ?>"><input type='checkbox' name="check[]" value="<?php echo $id; ?>"></td> </tr> This is the way how it grabs from database the list ! if(isset($_POST)){ if(count($_POST['check'])){ $list_selected = ""; foreach($_POST['check'] as $key => $ids){ $list_selected .= $ids .","; } $list_selected = substr($list_selected,0,strlen($list_selected)-1); // This will give ur selected ids like this 100,203,125,123 }else{ $list_selected = "-1"; } } Now the question ! How can I calculate from the price th $discount !? Thanks for help ! Quote Link to comment 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.