In php delete the row in html table:
Hi to everyone,
I have a problem in deleting the single row in html table.In html table each row has a delete link and auto_increment id.if u click the delete link the particular row has been deleted in both the html table and the database also.

//code for delete.php
<html>
<body>
<?php
//include("trealv.php");

$user = "root";
$pwd = "";
$host = "localhost";
$dbname = "phptable";




if(isset($_REQUEST['area']))

{

$id=$_REQUEST['area'];

$result=mysql_query("DELETE FROM estate WHERE Area=$id");

}
else
{
echo "No data is passed<br/>";
}



$conn = mysql_connect($host,$user,$pwd) or ("<br>[en] ERROR on MySQL server connection");
if(is_resource($conn))
{
echo "<b>your resource to MySQL Server is ok";
}
if(mysql_select_db($dbname,$conn))
{
echo "<br><b>you have selected $dbname<br/>";
}


mysql_close($conn);

?>
<a href ="jtable.php">click here to go back to the records</a>

</body>
</html>

//code for html table page

$num=0;
while($row = mysql_fetch_array($result))
  {
if($num % 2 ==0)
{
$bgcolor='#E8E8E8';
}
else
{
$bgcolor='#D0D0D0';
}

	echo "<tr bgcolor=$bgcolor>"; 
	echo "<td>".'<input type="checkbox" name="checkbox" />'."</td>";
 	echo "<td>".'<a href="update.php">Edit</a>'."</td>";
	echo "<td>".'<a href="delete.php">Delete</a>'."</td>";
        echo "<td>" . $row['id'] . "</td>"; 
	echo "<td>" . $row['Area'] . "</td>";
 	echo "<td>" . $row['Property'] . "</td>";
	echo "<td>" . $row['Bedroom'] . "</td>";
	echo "<td>" . $row['Bathroom'] . "</td>";
	echo "<td>" . $row['Budget'] . "</td>";   
	echo "<td>" . $row['Footage'] . "</td>";
	echo "<td>" . $row['Parktype'] . "</td>";
	echo "<td>" . $row['Smoker'] . "</td>";
	echo "<td>" . $row['Petshave'] . "</td>";
	echo "</tr>";
       $num++;
}
echo "</table>";

i got "No data is passed".
The value is passed from php validation page.How to pass the value.
I want your help..

Hi

Pass the id value in line number 66 & 67 for update and Delete option.

example:

<a href="delete.php?id=$row['id']">Delete</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.