I have a form in which by using javascript and in a while I add content to it. Denpending on the number of data in database different number of forms are added to the page.
<?php
while($row = mysql_fetch_array ($result)){
?>
<form method="post" accept-charset="UTF-8" >
//add some content to the form by reading from database
<div class="form-group ">
<input type="submit" name="print" id="button" value="print"/>
</div>
</form>
<?php
}//end while
?>
and below I want to redirect to another page when clicked on each "print" button. But not only it doesn't redirect to another page but also alert just works for the first button. Below is the code:
<script>
$("#button").click(function(){
alert('hi');
window.location.href = "design_card.php";
});
</script>
how to solve? jquery, php or javascript solutions are acceptable. other workable solutions, if work, are good.
Thanks for your response in advance.