title: Form doesn't work for the first record
body: <p>I m building a web application based on php for my company's sales.
  I 'm creating a functionality to give the salesman the ability to put his customers into lists in order to evaluate his actions.
  So I have a screen with the customers and on each row I have a dropdown menu that show: </p>
  
  <ol>
  <li>the lists that the customer already belongs</li>
  <li>the ability to add the customer to other existing list</li>
  <li>the ability to add the customer to a new list </li>
  </ol>
  
  <p>My problem is on the option c:
  I have created a form inside the dropdown in order to give an input for the new list name. The code works fine for all rows except first!!
  My code is :</p>
  
  <pre><code> /// check if the customer belong to a list
  
      $query1 = "SELECT `cust_fav_type` FROM `customers_favorites` WHERE cust_fav_fs_id = '{$customer_fs_id}' AND cust_fav_user_id='{$_SESSION['user_id']}' ";
                  $select_cb_lists = mysqli_query($connection,$query1);
  
                  if(mysqli_num_rows($select_cb_lists)){
  
                      $count = mysqli_num_rows($select_cb_lists);
  
      /// if he exists I m creating a link with remove ability                
                      ?&gt;
                      &lt;td class="text-center"&gt;
                      &lt;div class="dropdown"&gt;
                              &lt;h4&gt;
                                  &lt;button class="btn btn-info dropdown-toggle btn-xs" type="button" data-toggle="dropdown"&gt; &lt;b&gt;&lt;?php echo $count;?&gt;&lt;/b&gt;
                                  &lt;span class="caret"&gt;&lt;/span&gt;&lt;/button&gt;
                                  &lt;ul class="dropdown-menu dropdown-menu-right"&gt;
  
                         &lt;?php
  
                              while($row=mysqli_fetch_assoc($select_cb_lists)){
  
                              $c_list = $row['cust_fav_type'];
  
  
  
                              echo "&lt;li&gt;&lt;a href='posts.php?source=posts_list&amp;cust_fs_id=$customer_fs_id&amp;removefromlist=$c_list' onClick=\"javascript: return confirm('Σιγουρα θες να αφαιρέσεις τον $customer_name απο την λίστα $c_list?'); \"&gt; &lt;b&gt;$c_list&lt;/b&gt; &amp;nbsp;&lt;i class='text-danger'&gt;&lt;span class='glyphicon glyphicon-remove'&gt;&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;";
                              }
  
  
  
  /// ...and the ability to add to an existing list..
  
                                  $query = "SELECT ul.cust_fav_type FROM users_lists ul LEFT JOIN (SELECT `cust_fav_type` FROM `customers_favorites` WHERE cust_fav_fs_id = '{$customer_fs_id}' AND cust_fav_user_id='{$_SESSION['user_id']}') as a ON ul.`cust_fav_type` =a.`cust_fav_type` WHERE ul.`cust_fav_user_id`='{$_SESSION['user_id']}' AND a.cust_fav_type IS NULL ";
                                  $other_lists = mysqli_query($connection,$query);
  
                                  if(mysqli_num_rows($other_lists)){
  
                                  echo "&lt;li class='divider'&gt;&lt;/li&gt; ";
  
                                  while($row=mysqli_fetch_assoc($other_lists)){
  
                                      $list_name = $row['cust_fav_type'];
  
                                      echo "&lt;li&gt;&lt;a href='posts.php?source=posts_list&amp;cust_fs_id=$customer_fs_id&amp;addto=$list_name'&gt;Προσθηκη σε &lt;b&gt;$list_name&lt;/b&gt;&lt;/a&gt; &lt;/li&gt; ";
  
  
                                  }
                                  }
  
                              ?&gt;        
                     &lt;br&gt;
  
      /// THE Problem!! a form for inserting customer to a new list
  
  
                       &lt;li&gt;
                              &lt;form action="posts.php" method="get"&gt;
                                  &lt;div class="input-group"&gt;
                                      &lt;input class="form-control" type="hidden" name="source" value="posts_list"&gt;
                                      &lt;input type="hidden" name="cust_fs_id" value="&lt;?php echo $customer_fs_id;?&gt;"&gt;                           
                                      &lt;input class="form-control" type="text" name="addto" placeholder="Προσθηκη σε νεα λίστα"&gt;
                                      &lt;span class='input-group-btn'&gt; 
                                      &lt;button class='btn btn-primary' type="submit"&gt;&lt;span class='glyphicon glyphicon-plus'&gt;&lt;/span&gt;&lt;/button&gt;&lt;/span&gt;
                                  &lt;/div&gt;
                              &lt;/form&gt;
                          &lt;/li&gt;    
  
                      &lt;/ul&gt;
  
  
  
                      &lt;/h4&gt;
                      &lt;/div&gt;
  
                  &lt;/td&gt;
  
  
  
                      &lt;?php
  
  
                  } else {
  
                      $count = "-";
  
  
                      ?&gt;
  
                      &lt;td class="text-center"&gt;
                          &lt;div class="dropdown"&gt;&lt;h4&gt;
                                  &lt;button class="btn btn-primary dropdown-toggle btn-xs" type="button" data-toggle="dropdown"&gt;&lt;span class='glyphicon glyphicon-plus'&gt;&lt;/span&gt;&lt;span class="caret"&gt;&lt;/span&gt;&lt;/button&gt;
                                  &lt;ul class="dropdown-menu dropdown-menu-right"&gt;
  
                             &lt;?php
  
                                  $query = "SELECT cust_fav_type FROM customers_favorites ";
                                  $query .= " WHERE cust_fav_user_id={$_SESSION['user_id']} ";
                                  $query .= "GROUP BY cust_fav_type ORDER BY cust_fav_type ";
                                  $select_customers_cities = mysqli_query($connection,$query);
  
                                  while($row = mysqli_fetch_assoc($select_customers_cities)) {
                                  $customers_filters = $row['cust_fav_type'];
  
  
                                  echo "&lt;li&gt;&lt;a href='posts.php?source=posts_list&amp;cust_fs_id=$customer_fs_id&amp;addto=$customers_filters'&gt;Προσθήκη σε &lt;b&gt;$customers_filters&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;";
                                  }
  
                                  ?&gt;
                       &lt;/ul&gt;
                                  &lt;/h4&gt;
                                  &lt;/div&gt;     
  
                        &lt;/td&gt; 
  
  
                      &lt;?php  } ?&gt;
  </code></pre>
  
  <p>As I wrote this working fine for all rows of customers  except the first!
  Any help it will be valuable!</p>
  
  <p>Thanx!</p>