Only the first ID of the form is sending!

0

I'm trying to send a post without refresh with this method below but only sends the first form the second it redirects to page, I'm with the forms within a while PHP

$(function($) {
    $('#enviaadv').submit(function() {

        $(this).ajaxSubmit(function(resposta) {
            if (!resposta){
                $onclick = showadv('bottom','left',resposta);
            }
            else
            {
                $onclick = showadv('bottom','left',resposta);
            }

        });

        return false;

    });
});
</script>   
<form id="enviaadv" action="functions/advogadoresponsavel.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="advid" value='awdawd'>
    <input type="hidden" name="advnome" value='awdawd'>
    <input type="hidden" name="idunico" value='adawdaw'>

        <button class="btn btn-success btn-link btn-just-icon btn-sm">
            <i class="material-icons">person_add</i>
        </button>
</form> 
<form id="enviaadv" action="functions/advogadoresponsavel.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="advid" value='dawd'>
    <input type="hidden" name="advnome" value='awdawd'>
    <input type="hidden" name="idunico" value='awdawd'>

        <button class="btn btn-success btn-link btn-just-icon btn-sm">
            <i class="material-icons">person_add</i>
        </button>
</form> 
    
asked by anonymous 18.06.2018 / 20:51

1 answer

0

First FORM :

<input type="hidden" name="idunico" value='adawdaw'>

Second FORM :

<input type="hidden" name="idunico" value='awdawd'>

The ids are the same. Try changing the name, such as idunico2 .

    
18.06.2018 / 20:55