title: Undefined index solved using isset, but cannot insert data in database
body: <p>I have already used <code>isset</code> function to erase the undefined index, but problems occur on other function such as when I submit my data into my database in localhost server it cannot be seen or inserted.
  **</p>
  
  <pre><code>  &lt;?php
              $con = mysqli_connect ('127.0.0.1','root','');
              if (!$con)
              {
                  echo 'Not connected to server';
              }
  
              if(!mysqli_select_db($con,'contact'))
              {
                  echo 'database not selected';           
              }
  
  
  
              $name = $_POST['name'];
              $subject = $_POST['subject'];   
              $email = $_POST['email'];
              $message = $_POST['message'];
  
              $sql = "INSERT INTO feedback (name, subject, email, message)    
               VALUES ('$name', '$subject', '$email','$message')";
                 ?&gt;
  
             &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
             &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
             &lt;head&gt;
           &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
            &lt;title&gt;Tam Nasi Ayam&lt;/title&gt;
           &lt;link href="styles/style.css" rel="stylesheet" type="text/css"    
           media="screen" /&gt;
            &lt;/head&gt;
           &lt;body&gt;
            &lt;div id="container"&gt;
           &lt;header&gt;
            &lt;nav&gt;
            &lt;ul id="nav"&gt;
            &lt;li&gt;&lt;a href="index.php"&gt;Home&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="menu.php"&gt;Menu&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="promotion.php"&gt;Promotion&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="gallery.php"&gt;Gallery&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="contact.php" class="current"&gt;Contact&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
            &lt;/nav&gt;
          &lt;/header&gt;
          &lt;/div&gt;
           &lt;/body&gt;
  
  
           &lt;?php
  
           if (isset($_POST['upload_img'])){
           $file_name = $_FILES['image'] ['name'];
           $file_type = $_FILES['image'] ['type'];
           $file_size = $_FILES['image'] ['size'];
           $file_tmp_name = $_FILES['image'] ['tmp_name'];
  
           if ($file_name{move_uploaded_file($file_tmp_name,"img/$file_name");
  
  
              }
              }
              ?&gt;
             &lt;html&gt;
             &lt;body&gt;
             &lt;center&gt;
  
  
             &lt;form action="" method="post" enctype="multipart/form-data"      
             align="center"&gt;
              &lt;label&gt;Upload Image&lt;/label&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type="file" name="image"&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type="submit" value="Upload Image" name="upload_img"&gt;
  
               &lt;/form&gt;
  
               &lt;/center&gt;
               &lt;/body&gt;
                &lt;/html&gt;
  
  
                &lt;?php
  
  
                $folder = "img/" ;
  
  
                 if(is_dir($folder)){if($handle = opendir($folder)){
  
                  while (($file=readdir($handle))!= false) {
  
                  if ($file==='.'|| $file=== '..') continue;  
  
           echo '&lt;img src="img/'.$file.'" width="150" height="150" alt=""   
            align="center"&gt;';
  
             }
           closedir($handle);
              }   
  
  
               }
  
               ?&gt;
  
  
           &lt;form name="form 2" method="post" align="center"       
           action="foodfile.php"&gt;&lt;br&gt;    
           &lt;br&gt;
  
           Days:&lt;input name="days" type="text" /&gt;
  
           &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  
  
             &lt;br&gt;&lt;br&gt;
           Date: &lt;input type="text" name="date"  /&gt;
           &lt;/label&gt;    
             &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  
            Time: &lt;input  type="text" name="time" /&gt;&lt;br&gt;&lt;br&gt;
  
  
            Food: &lt;input type="text" name="food" /&gt;&lt;br&gt;&lt;br&gt;
  
  
            Drink:&lt;input type="text" name="drink" /&gt;&lt;br&gt;&lt;br&gt; 
  
  
            Custom: &lt;br&gt; &lt;textarea name="custom" &gt;&lt;/textarea&gt; &lt;br&gt;&lt;br&gt;         
  
             Price: &lt;input name="price" type="text" /&gt;
  
              &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  
  
              &lt;div align="center"&gt;
               &lt;p&gt;
             &lt;input type="submit" name="button"  value="Submit" /&gt;
  
              &lt;input type="submit" name="button3"  value="Default" /&gt;
              &lt;/p&gt;
              &lt;/div&gt;
              &lt;/form&gt;
  
  
  
               &lt;?php
               if (!mysqli_query ($con, $sql))
              {
              echo '';
  
              }
              else
               {
              echo '';    
                }
                ?&gt;
  
              &lt;div class="border2"&gt;&lt;/div&gt;
              &lt;br&gt;
              &lt;/div&gt;
               &lt;footer&gt;
              &lt;div class="border"&gt;&lt;/div&gt;
              &lt;div class="footer-widget"&gt;
              &lt;h6&gt;Sitemaps&lt;/h6&gt;
               &lt;a href="index.php"&gt;Homepage&lt;/a&gt;&lt;br&gt;
               &lt;a href="menu.php"&gt;Menu&lt;/a&gt;&lt;br&gt;
               &lt;a href="promotion.php"&gt;Promotion&lt;/a&gt;&lt;br&gt;
                &lt;a href="gallery.php"&gt;Gallery&lt;/a&gt;&lt;br&gt;
               &lt;a href="contact.php"&gt;Contact&lt;/a&gt;&lt;br&gt;
                &lt;/div&gt;
              &lt;div class="footer-widget"&gt;
               &lt;h6&gt;HighTech Sdn. Bhd.&lt;/h6&gt;
             &lt;p&gt;&amp;copy; Copyright 2012 - All Rights Reserved HighTechnology 
              Sendirian Berhad&lt;/p&gt;&lt;br&gt;
               &lt;/div&gt;
  
                &lt;div class="footer-widget"&gt;
                 &lt;h6&gt;We Are Social!&lt;/h6&gt;
                 &lt;div id="social"&gt; &lt;a    
                 href="http://instagram.com/explore/locations472284877/"                 
                  class="s3d forrst" &gt;   
                 Instagram &lt;span class="icons forrst"&gt;&lt;/span&gt;&lt;/a&gt;  
               &lt;a href="https://ms-my.facebook.com/Tamnasiayam" class="s3d 
                   facebook"     
                 target="_blank"&gt; Facebook &lt;span class="icons facebook"&gt;             
                 &lt;/span&gt; &lt;/a&gt;&lt;/div&gt;
                 &lt;/div&gt;
                   &lt;br&gt;
                 &lt;br /&gt;
                  &lt;/span&gt;&lt;/span&gt;&lt;/footer&gt;
               &lt;/div&gt;
                &lt;/body&gt;
                 &lt;/html&gt;
  </code></pre>
  
  <p>**</p>