madmenyo Posted May 20, 2010 Share Posted May 20, 2010 Hey, for each loop $slotcounter returns me "4" .... wich is weird because i do get 4 buttons displayed. print $_POST['wslot']; return only slot4 to mo wichever button i click. I need it to be button 1,2,3,4 <?php if (isset($_POST['useweapon'])) { print $_POST['useweapon']; echo "</br>"; print $_POST['wslot']; } } ?> <form action="" method="post"> <?php $slotcounter = 1; //while ($slotcount['weaponslots'] >= $slotcounter) while ($slotcounter <= 4) { ?> <input type="hidden" value="slot<?php echo $slotcounter;?>" name="wslot"> <INPUT TYPE="image" SRC="images/slot<?php echo $slotcounter;?>.jpg" HEIGHT="11" WIDTH="11" BORDER=0 ALT="^" name="useweapon" value="<?php echo $weaponrows['weaponID'];?>"> <?php $slotcounter++; } ?> </form> Quote Link to comment Share on other sites More sharing options...
smarble53 Posted May 20, 2010 Share Posted May 20, 2010 It seems to be working for me. BUUUT... <?php if (isset($_POST['useweapon'])) { print $_POST['useweapon']; echo "</br>"; print $_POST['wslot']; } } ?> Why is there a second curly brace after this? is it in another if or while loop? Quote Link to comment Share on other sites More sharing options...
madmenyo Posted May 20, 2010 Author Share Posted May 20, 2010 I actually had to reverse $slotcounter and $weaponrows for it to work, i don't know why but it works like it should. i speneded like 2 hours on this The bracket is from another statement, i shouldn't have included that in the code sorry, 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.