Mam problem z powtarzajaca sie nazwa formularza usuwajacego rekordy oraz elementu input
WCZYTUJE DANE Z BAZY
<?php $pytanie = "SELECT * FROM model.mysli"; <form name=\"bbb\" onsubmit=\"ajax_del('mysli'); return false;\"> <input type=\"hidden\" name=\"id\" value=\"".$wiersz["id"]."\" /> <input type=\"submit\" value=\"\" id=\"form-usun\" /> </form> <b>ID:</b>".$wiersz["id"]."<br/> <b>MYSL:</b>".$wiersz["mysl"]."<br/> <b>STATUS:</b>".$wiersz["mysl_status"]."<br/><br/>"; } ?>
FORMULARZEM przesylam id do JS
function ajax_del(a)
{
var id = document.bbb.id.value;
if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState == (1 || 0)) { document.getElementById('loading').style.display = 'block'; }
if (xmlhttp.readyState != (1 || 0 || 4)) { document.getElementById('loading').style.display = 'none'; }
if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(a).innerHTML= '<div class="scrolling">'+xmlhttp.responseText+'</div>';}
}
xmlhttp.open("POST","pages/"+a+".php5",true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("&id=" + id );
}
formularzem przesylam id do AJAX i usuwam rekord, wszystko dziala jesli w bazie jest tylko 1 rekord bo jesli jest wiecej to powtarza sie nazwa form i input i w tym momencie ajax nie dostaje id, ktore jest mi potrzebne zeby usunac rekord z bazy
Wiecie jak mozna rozwiazac problem
