-1
http://domain.com/update.php?id=DCS013001

I am using get method for store id in variable

   if ($_GET['id']!="") {
    $id=$_GET['id'];
      mysql_query("DELETE FROM empmaster where empid=' ". $id. " ' ");
      header('Location:tables.php');
}

but its not working

Aditya Dwivedi
  • 252
  • 5
  • 20

2 Answers2

1

Use isset()

if(isset($_GET['id']))
{
$id=$_GET['id'];
echo $id;
}
0

You should add a check if it is present -

$id = !empty($_GET['id']) ? $_GET['id'] : false; // Or store anything that would be useful to $id

Store $id only if it is set else store something else or not store it. But if you don't store $id you have to add check for the same where ever you ar using it.

Sougata Bose
  • 31,517
  • 8
  • 49
  • 87