kaosjon Posted October 10, 2011 Share Posted October 10, 2011 Hi, i have added a section to my website where it loops each record, and it does this pretty well, however i want to add a button that if pressed closes the record, like an ignore button, would this require a database where it stores the record closed so that it never opens it to the user again. Any ideas you have about this i could use. Heres my code for the loop. <?php while($row = mysql_fetch_assoc($sql_cpa)) : ?> <?php extract($row);?> <div class="offers"> <div class="picture"><img src="images/images.jpg" width="125" height="125" /></div><!----end picture----> <div class="offer_content"> <div class="offer_info"> <h6><?php print "$name";?></h6><p><?php print "$description";?></p> <p><?php print "$requirements";?></p> </div><!----end offer_info----> <div class="offer_tools"> <h6><?php print "$penny_value";?></h6> <p>Pennies</p> <h6><a href="<?php print "$url";?>user_id=<?php print "$id";?>&offer_id=<?php print "$offerid";?>">Begin</a></h6> <h6>CLOSE</h6> </div><!----end offer_tools----> </div><!----end offer_content----> <div class="cpa_footer"> <p>Payout: <?php print "$payout";?> || Difficulty: <?php print "$difficulty";?> || <?php print "$free";?></p> </div><!----end cpa_footer----> </div><!----end offers----> <?php endwhile ?> The close button is located in the offer_tools div. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/248845-close-button-added-to-the-loop/ Share on other sites More sharing options...
sunfighter Posted October 11, 2011 Share Posted October 11, 2011 Your doing this in php which is on the server. Can't be controlled via a browser button. (yeah AJAX I know). Do this in javascript. add a string that the button can control it's value. Have the loop check this string at the end of each loop and if set to death value break; out of loop. Quote Link to comment https://forums.phpfreaks.com/topic/248845-close-button-added-to-the-loop/#findComment-1277988 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.