title: Is it possible to add selected content of dynamic select list to a new table?
body: <p>I have a database with the name <strong><em>'ecc'</em></strong>.</p>
  
  <p>The database has a table with the name <strong><em>'task'</em></strong>.</p>
  
  <p>The table task has three fields named as <strong><em>'assignedto'</em></strong> <strong><em>'subject' 'date'</em></strong>.</p>
  
  <p>Appropriate Data type for date is used.</p>
  
  <p><strong><em>'assignedto'</em></strong> field must content the selected content of select list.</p>
  
  <p><strong><em>'subject'</em></strong> is simply a text field.</p>
  
  <p><strong><em>'date'</em></strong> field should contain date in <strong><em>'yyyy/mm/dd'</em></strong> formate.</p>
  
  <p>The content of select list is extracted from table <strong><em>'client'</em></strong>  of field 
  <strong><em>'ProjectManager'</em></strong> from same <strong><em>'ecc'</em></strong> database.</p>
  
  <p>My issue withe the below code is:- It is not inserting the selected content of select list into table 'task' in field <strong><em>'assignedto'</em></strong> following fields <strong><em>'subject'</em></strong> and <strong><em>'date'</em></strong>.</p>
  
  <p>It is showing me few warnings related to <strong><em>if(isset($_post(''))</em></strong>.</p>
  
  <p>If i don't use <strong><em>if(isset($_post(''))</em></strong> the it is showing me warning for undeclared variable.</p>
  
  <p>The warnings are:-</p>
  
  <p>1)Notice: Undefined index: $mysqli in C:\wamp\www\select.php on line 53</p>
  
  <p>2)Notice: Undefined index: subject in C:\wamp\www\select.php on line 57</p>
  
  <p>3)Notice: Undefined index: date in C:\wamp\www\select.php on line 58</p>
  
  <pre><code>&lt;?php
  // Connect db
  $mysqli = new mysqli('localhost','root','','ecc');
  
  // check if error
  if ($mysqli-&gt;connect_error) {
      die('Can not connect to DB error : ('. $mysqli-&gt;connect_errno .') '. 
  $mysqli-&gt;connect_error);
  }
  echo "Select client";
  
  // MySqli Select Query
  $results = $mysqli-&gt;query("SELECT ProjectManager FROM client");
  
  echo '&lt;select name="project_manager"&gt;';
  echo '&lt;option value=""&gt;-select project manager-&lt;/option&gt;';
  while($row = $results-&gt;fetch_assoc()) {
      echo '&lt;option 
  value="'.$row['ProjectManager'].'"&gt;'.$row['ProjectManager'].'&lt;/option&gt;';
  }  
  echo '&lt;/select&gt;';
  
  // Frees memory
  
  $results-&gt;free();
  
  ?&gt;
  
  
  
  &lt;html&gt;
  &lt;body&gt;
  &lt;form action = "select.php" method ="POST"&gt;
  
  
    Subject:&lt;br&gt;
  
    &lt;input type="text" name="subject"&gt;&lt;br&gt;
  
    &lt;br&gt;
  
      &lt;input type = "date" name = "date"&gt;&lt;br&gt;
  
  &lt;input type="submit" value="submit"&gt;  
  
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  
  &lt;?php
  
  $assignedto = $_POST['$mysqli'];
  
  
  
      $subject = $_POST['subject'];
      $date = $_POST['date'];
  
  
  
  
  $sql="INSERT INTO task (assignedto,
                          subject,
                          date)
                          VALUES('$assignedto','$subject',
                          '$date')";
  
  
  if(mysqli_query($mysqli,$sql))
  {
      echo 'record added';
  }
  
  else
  {
      echo 'record not added';
  }
  //header("refresh:02;url=index.html");
  ?&gt;
  </code></pre>