Problem with delete function

Hello everyone!

I have a script that when i click on a category is opened a new page (katlajme_edit.php on my case) where are loaded all infos of that category on a form and at the end of that form is a checkbox that offers the delete option for that category…but…it didn;t work! I don’t know what’s going on, bcz didn;t appear any error msg. It says that the modifications is done but that row is not deleted !

This is my script:

 <?
include('header.php');

echo '<div class="majtas">';
if(!$_GET['lkatid'] &&  !isset($_POST['do_edit']) &&  !isset($_POST['edit_katlajme'])) {

echo $error;

// Shfaq listen e kategorive
lista_kategorilajmesh();

}



// Has the edit form been submitted?

if(isset($_POST['do_edit'])) {
    
    $LKatID=  $_POST['LKatID'];
    $LKatEmri = $_POST['LKatEmri'];
    $LKatLink = $_POST['LKatLink'];
    $LKatAktiv = $_POST['LKatAktiv'];
    
    $fshij =  $_POST['fshij'];

    
    // Ticked the 'delete category'  box? If so, delete and echo message.    
    if($fshij== 'fshij_LKatID' && $error = '') {
        
    $sql =  "DELETE FROM lajme_kategori WHERE  LKatID='$LKatID'";
    $query =  mysql_query($sql) or die("Fatal error: ".mysql_error());

    echo "<h3>U Fshi</h3>";
    echo "<div  class='success_message'>Kategoria <b>$LKatID</b> u fshi  nga sistemi.</div>";
    
    echo "<h2>What to do  now?</h2><br />";
    echo "Go to the <a  href='katlajme_edit.php'>edit category</a> page.</li>";
        
    } else {
    
    // Validate the submitted  information
    
        if(trim($LKatID) == '1') {
            $error = '<div  class="error_message">LKatID - Attention! You cannot edit the main  Administrator, use database.</div>';
        } else if(trim($LKatEmri) == '') {
            $error = '<div  class="error_message">LKatEmri - Attention! You must enter a first  name.</div>';
        } else if(trim($LKatLink) == '') {
            $error = '<div  class="error_message">LKatLink - Attention! You must enter a last  name.</div>';
        }  
        
    // Password been entered? If so,  validate and update information.
    
        if(trim($LKatEmri) == '') {
        $error = '<div  class="error_message">Attention! You must enter category  name.</div>';
          } else if(trim($LKatLink) == '') {
        $error = '<div  class="error_message">Attention! You must enter category  link.</div>';
        }  
            
            if($error == '') {
        
            $sql = "UPDATE lajme_kategori  SET LKatEmri='$LKatEmri', LKatLink='$LKatLink', LKatAktiv='$LKatAktiv'  WHERE LKatID = '$LKatID'";
            $query = mysql_query($sql) or die("Fatal error: ".mysql_error());
        
            echo "<h2>U  Modifikua</h2>";
            echo "<div  class='success_message'>Kategoria u modifikua: <b>$LKatEmri  ($LKatLink)</b> me ID <b>$LKatID </b>.</div>";
            
            echo "<h2>What to do  now?</h2><br />";
            echo "Go to the <a  href='katlajme_edit.php'>edit category</a> page.</li>";
            
            }
    
    
        }
        
    }


// Has a category been selected to  edit?

if($_GET['lkatid'] && !isset($_POST['do_edit']) && !isset($_POST['edit_katlajme']) || $error != '') {

    $LKatID = $_GET['lkatid'];
    
    $sql =  "SELECT * FROM lajme_kategori WHERE  LKatID='$LKatID'";  
    $result = mysql_query($sql);
    
    $row =  mysql_fetch_array($result);
    
    $LKatEmri = $row['LKatEmri'];
    $LKatLink = $row['LKatLink'];
    $LKatAktiv = $row['LKatAktiv'];
    
        
    echo $error;
            
    echo "<h2>Informacionet per  kategorine ( ".stripslashes($row['LKatEmri'])." )</h2>";
    
?>
 
<form action="" method="post">
<input type="hidden" name="LKatID" value="<?=$row['LKatID'];?>" />

<label>Emri Kategorise</label>
<input type="text" name="LKatEmri" value="<?=stripslashes($row['LKatEmri']);?>"  style="width: 46%;" /><br />

<label>Link</label>
<input type="text" name="LKatLink" value="<?=stripslashes($row['LKatLink']);?>"  /><br />

<label style="width: 50%;">Aktive</label>
<input id="LKatAktiv" name="LKatAktiv" type="checkbox" <?php if ($LKatAktiv == "PO") { echo "checked";} ?> value="PO">
<br /><br />
<div class="error_message">Do fshish kete kategori? (Nuk  kthehet mbrapsh!) <input type="checkbox" class="checkbox"  name="fshij" value="fshij_LKatID"></div>
<input type="submit" value="Ruaje" name="do_edit" />
</form>

<? }  
echo '</div>';
include('poshte.php'); ?>  

and the db table is:

-LKatID - init
-LKatEmri
-LKatLink
-LKatAktiv

Hooping that someone can help me with this issue!

Thank you in advance!

It works now … Was a quote and equal problem :wink:

Was:

 // Ticked the 'delete category'  box? If so, delete and echo message.     
    if($fshij== 'fshij_LKatID' && $error = '') {
$sql =  "DELETE FROM lajme_kategori WHERE  LKatID='$LKatID'";

IS NOW

// Ticked the 'delete category'  box? If so, delete and echo message.     
    if($fshij== 'fshij_LKatID' && $error == '') { 
         
    $sql =  "DELETE FROM lajme_kategori WHERE  LKatID=$LKatID";