Jump to content

While loop inside while loop


madmenyo

Recommended Posts

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>

 

 

Link to comment
https://forums.phpfreaks.com/topic/202329-while-loop-inside-while-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.