I want to get the value of check box selected and pass it to a query for deleting the value from database. java script code
function deleteRows(){
isTable = document.getElementById('dataTbl');
nBoxes = document.getElementsByName('delBox');
for (i=nBoxes.length-1; i>=0; i--)
{
if (nBoxes[i].checked === true)
{
var a =nBoxes[i].value;
alert("Do you want to delete this row?"+a);
isTable.deleteRow(i+1);
}
}
}
i need the var a value in perl so that i can pass it to the delete query and delete the selected row.
html code
<Table id='dataTbl' border='1' >
<tr>
<td><input type=checkbox name='delBox' value=@data></td>
<td bgcolor=#0099FF>$pid</td>
<td bgcolor=#99CCFF>$project_name</td>
<td bgcolor=#3399FF> $variant_no</td>
<td bgcolor=#99CCFF> $variant_name</td>
<td bgcolor=#3399FF>$vehicle_class</td>
<td bgcolor=#99CCFF> $vc_no</td>
</table>
<input type=button value="Delete Rows" onclick="deleteRows()" id="delbtn">
perl query
my $sth = $dbh->prepare("delete form table name col1,col2,col3 where id='$a'");
$sth->execute() or die "$!";