Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script>
  $(document).ready(function(){
  $('.myButton').click(function() {
    var $ct = $(this).next("div.container");
    if (this.value == 'collapse') {
  this.value = 'expand';
  $ct.hide("slow");
 $('.myButton').parent().show("slow");
    } else {
  this.value = 'collapse';
  $ct.show("slow");
 $('.myButton').not($(this)).parent().hide("hide");
    }

  });
});
</script>
</head>
<body>
<?php
for($i=0;$i<=3;$i++)
{
echo"<div class='main' style='removed:relative;border:1px solid #A5BEBE;background-        color:#E7EFEF;width:84%;  '> 
 sometext:-<a href='#'>$url</a><br>
sometext :$b<br>
</p>
<input type='button' value='expand' class='myButton'  name='button1' target='".$i."'       onclick='clickButton(this)'        style='position:absolute;left:85%;top:4%;background:#B20000;color:white;width:70px;height:20px;font-        size:15px;' >";

echo "<div  class='container'  style='display:none;background:white; '>
   sometext:-<a href='#'>$url</a><br>
sometext :$b<br>
sometext :$c<br>
</p>";
if(isset($_GET['button1']))
{ 
echo"<script>alert('msg1');</script>";
include('function.php'); 
} 
echo "</div>";
echo "</div>";
}
?>
</body>
</html>


we are creating four buttons in a for loop with same name and id , if we press even a single button out of four FUNCTION.PHP should be called and executed . for this we have used isset function but its not working.
Posted
Comments
Sergey Alexandrovich Kryukov 12-Dec-14 1:33am    
What exactly do you mean by "not working"?
—SA
Member 11107959 12-Dec-14 2:18am    
their is an alert in function.php which is not been called

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900