Witam.
Znalazłem w sieci prosty shoutbox na ajax-ie i mysql i ładnie mi działa, ale chciałbym sobie dołożyć możliwość kasowania wpisów gdy mam uprawnienia administratora. Przedstawię może źródła.

index.php - część, w której jest wyświetlany shoutbox.
CODE
<form method="post" id="formularz">
<table>
<tr>
<td><label>Użytkownik</label></td>
<td><input class="text user" id="nick" type="text" MAXLENGTH="25" <?php if(isset($_SESSION['nazwa'])) echo "value=\"".$_SESSION['nazwa']."\"";?>/></td>
</tr>
<tr>
<td><label>Wiadomość</label></td>
<td><input class="text" id="message" type="text" MAXLENGTH="255" /></td>
</tr>
<tr>
<td></td>
<td><input id="send" type="submit" value="Wyślij" /></td>
</tr>
</table>
</form>
<label id="odswiez"></label>
<div id="container">
<div class="content">
<div id="loading"><img src="css/images/loading.gif" alt="Loading..." /></div>
<center><caption style=" text-align: center">Shoutbox</caption></center>
<table width="850" border=0 cellspacing=0>
</table>
</div>
</div>


shoutbox.php - część, która wyświetla wyniki w index.php.
CODE
switch($_POST['action'])
{
case "update":
$res = getContent($link, 20);
$i = 0;
while($row = mysql_fetch_array($res))
{
$dzien = explode(" ", $row['date']);
// echo $dzien[0];
// echo date("Y-m-d");
if($dzien[0] == date("Y-m-d"))
$data = 'dzisiaj '.$dzien[1];
else
$data = $row['date'];
$color = ($i % 2) ? '#FFFFFF' : '#CCCCCC';
$result .= "
<tr style=\"background-color:$color\"><td width=\"15%\"><span class=\"date\">".$data."</span></td><td width=\"15%\"><strong>".$row['user']."</strong></td><td width=\"60%\">".$row['message']."</td>";
if($_SESSION['uprawnienia'] == 2)
$result .= "<td><form action=\"\" method=\"POST\" id=\"kasuj\"><input type=\"hidden\" id=\"id_shout\" value=\"".$row['id']."\"><input type=\"image\" src=\"obrazki/no.png\" width=\"10\" height=\"10\" onclick=\"this.alert(\"tak\");\"></form></td>";
$result .= "</tr>";
$i++;
}
echo $result;
break;
case "insert":
echo insertMessage($_POST['nick'], $_POST['message']);
break;
case "delete":
echo deleteMessage($_POST['id']);
break;
}


shoutbox.js - javascript z ajax, czyli to co odwala robotę smile.gif
CODE
$(document).ready(function()
{
//global vars
var inputUser = $("#nick");
var inputMessage = $("#message");
var loading = $("#loading");
var messageList = $(".content > table");

//functions
$("#odswiez").click(function()
{
//just for the fade effect
// messageList.hide();
// loading.fadeIn();
//send the post to shoutbox.php
$.ajax(
{
type: "POST", url: "shoutbox.php", data: "action=update",
complete: function(data)
{
loading.fadeOut();
messageList.html(data.responseText);
messageList.fadeIn(2000);
}
});
});

function updateShoutbox()
{
//just for the fade effect
messageList.hide();
loading.fadeIn();
//send the post to shoutbox.php
$.ajax(
{
type: "POST", url: "shoutbox.php", data: "action=update",
complete: function(data)
{
loading.fadeOut();
messageList.html(data.responseText);
messageList.fadeIn(2000);
}
});
}
//check if all fields are filled
function checkForm()
{
if(inputUser.attr("value") && inputMessage.attr("value"))
return true;
else
return false;
}

//Load for the first time the shoutbox data
updateShoutbox();

//on submit event
$("#formularz").submit(function()
{
if(checkForm())
{
var nick = inputUser.attr("value");
var message = inputMessage.attr("value");
//we deactivate submit button while sending
$("#send").attr({ disabled:true, value:"Wysyłanie..." });
$("#send").blur();
//send the post to shoutbox.php
$.ajax(
{
type: "POST", url: "shoutbox.php", data: "action=insert&nick=" + nick + "&message=" + message,
complete: function(data)
{
messageList.html(data.responseText);
updateShoutbox();
//reactivate the send button
$("#send").attr({ disabled:false, value:"Wyślij" });
$("#message").val("");
}
});
}
else alert("Proszę wypełnić wszystkie pola!");
//we prevent the refresh of the page after submitting the form
return false;
});

// alert(id_kasuj);

$("#kasuj").submit(function()
{
var id_kasuj = $F("#id_shout");
var id = messageList.getElementById['id_shout'].value();//id_kasuj.attr("value");
alert("test");
//we deactivate submit button while sending
$("#send").attr({ disabled:true, value:"Kasowanie..." });
$("#send").blur();
//send the post to shoutbox.php
$.ajax(
{
type: "POST", url: "shoutbox.php", data: "action=delete&id=" + id,
complete: function(data)
{
messageList.html(data.responseText);
updateShoutbox();
//reactivate the send button
$("#send").attr({ disabled:false, value:"Wyślij" });
$("#message").val("");
}
});
return false;
});
});


No i moim zamierzeniem było dokoptować do tego wyniku z shoutbox.php formularz dla każdej linijki, którego aktywacja przekazywałaby ukrytą wartość 'id' postem do shoutbox.php aby skasowac wpis o tym 'id'. No i wszystko ładnie pięknie, ALE. No skrypt odczytuje wartości elementów formularza po ID jedynie z pliku index.php, za nic nie chce mi odczytać elementów po ID z formularza, który jest wyświetlany jako odczyt tabeli z wpisami, czyli w tym miejscu
CODE
$("#kasuj").submit(function()

próbuję się dostać jakoś do formularza ale za nic nie potrafię. Czy jest ktoś w stanie mi pomóc? Pozdrawiam.