title: Call to undefined function sanitize()
body: <p>I'm working on an e-commerce project, currently on back end on the project where you can add or remove menus or sub-menues of categories .</p>
  
  <p>I have checked dlls are enabled</p>
  
  <p>That's the error I'm getting</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined function sanitize() in C:\xampp\htdocs\project\admin\categories.php on line 15</p>
  </blockquote>
  
  <p>Here is the code</p>
  
  <pre><code>&lt;?php
   require_once $_SERVER['DOCUMENT_ROOT'].'/project/core/init.php';
   include 'includes/head.php';
   include 'includes/navigation.php';
  
   $sql = "SELECT * FROM categories WHERE parent = 0";
  $result = $db-&gt;query($sql);
  $errors = array();
  // when the form is cick process
  
  $Category = '';
  $parent= '';
  
  if(isset($_POST) &amp;&amp; !empty($_POST)){
    $parent = sanitize($_POST['parent']);
    $category = sanitize($_POST['category']);
    $sqlform = "SELECT * FROM categories WHERE category ='$category' AND parent = '$parent'";
    $fresult = $db-&gt;query($sqlform);
    $count = mysqli_num_rows($fresult);
   //if category is blank
  
   if($category == ''){
    $errors[] .= 'The category cannot be left blank';
    }
  
   //if it already exixt in database
   if($count &gt; 0){
    $errors[] .= $category.' Already exits please choose a new category'; 
   }
   //display error or update database
   if(!empty($errors)){
   $display = display_errors($errors);?&gt;
   &lt;script&gt;
      jQuery('document').ready(function(){
    jQuery ('#errors').html('&lt;?php $display;?&gt;');   
  
      });
  
   &lt;/script&gt;
  
  
  &lt;?php } else{
   //update database
   $updatesql = "INSERT INTO categories(category,parent)VALUES ('$category','$parent')";
   $db-&gt;query($updatesql);
   header('location:categories.php');
  }
  }
  
  
  ?&gt;
  </code></pre>