Dynamicly show/hide div which has value the same as button

Dynamicly show/hide div which has value the same as button

In a loop I add dynamicly in php button and  div which is hidden by css 
  1. echo "<input type=\"submit\" value=\"$entry\" class=\"button\">";
  2. echo "<p id=\"mydiv\" value=\"$entry\"></p>";
 i want to show/hide only this div which has the same value as button.