I am trying to delete the entire row using the php code.
But before that my page has a multiple rows ended with radio button before clicking delete button we have to select anyone of the radio button, then we can click on delete.
but what i want is, i have written a java-script code that gets the radio button value and after that i want to get that javascript variable value to php code and then execute the delete command..
Here is what i have tried
code javascript
<script>
function getResults() {
var radios = document.getElementsByName("address");
for (var i = 0; i < radios.length; i++) {
if (radios[i].checked) {
var a = radios[i].value
alert(a);
break;
}
}
</script>
php code:
<?php
$_GET['a']
mysql_connect("localhost", "tiger", "tiger") or die (mysql_error ());
mysql_select_db("theaterdb") or die(mysql_error());
$strSQL =("DELETE FROM theater WHERE theater_name='"$_POST["a"]"'");
$rs = mysql_query($strSQL);
mysql_close();
?>
}
But this is not working
i even tried this also.it is also not working
<?php
if ($_POST['submit'])
{
$_GET['a'];
mysql_connect("localhost", "tiger", "tiger") or die (mysql_error ());
mysql_select_db("theaterdb") or die(mysql_error());
$strSQL =("DELETE FROM theater WHERE address='".$_POST["a"]."'");
$rs = mysql_query($strSQL);
mysql_close();
}
?>