Php 表格不适用于第一条记录

Php 表格不适用于第一条记录,php,forms,Php,Forms,我正在为我公司的销售构建一个基于php的web应用程序。 我正在创建一个功能,让销售人员能够将他的客户放入列表中,以便评估他的行为。 因此,我有一个客户屏幕,每行都有一个下拉菜单,显示: 客户已经属于的列表 将客户添加到其他现有列表的能力 将客户添加到新列表的功能 我的问题在于选项c: 我在下拉列表中创建了一个表单,以便为新列表名提供输入。该代码适用于除第一行之外的所有行!! 我的代码是: /// check if the customer belong to a list $que

我正在为我公司的销售构建一个基于php的web应用程序。 我正在创建一个功能,让销售人员能够将他的客户放入列表中,以便评估他的行为。 因此,我有一个客户屏幕,每行都有一个下拉菜单,显示:

客户已经属于的列表 将客户添加到其他现有列表的能力 将客户添加到新列表的功能 我的问题在于选项c: 我在下拉列表中创建了一个表单,以便为新列表名提供输入。该代码适用于除第一行之外的所有行!! 我的代码是:

 /// 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                
                    ?>
                    <td class="text-center">
                    <div class="dropdown">
                            <h4>
                                <button class="btn btn-info dropdown-toggle btn-xs" type="button" data-toggle="dropdown"> <b><?php echo $count;?></b>
                                <span class="caret"></span></button>
                                <ul class="dropdown-menu dropdown-menu-right">

                       <?php

                            while($row=mysqli_fetch_assoc($select_cb_lists)){

                            $c_list = $row['cust_fav_type'];



                            echo "<li><a href='posts.php?source=posts_list&cust_fs_id=$customer_fs_id&removefromlist=$c_list' onClick=\"javascript: return confirm('Σιγουρα θες να αφαιρέσεις τον $customer_name απο την λίστα $c_list?'); \"> <b>$c_list</b> &nbsp;<i class='text-danger'><span class='glyphicon glyphicon-remove'></span></i></a></li>";
                            }



/// ...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 "<li class='divider'></li> ";

                                while($row=mysqli_fetch_assoc($other_lists)){

                                    $list_name = $row['cust_fav_type'];

                                    echo "<li><a href='posts.php?source=posts_list&cust_fs_id=$customer_fs_id&addto=$list_name'>Προσθηκη σε <b>$list_name</b></a> </li> ";


                                }
                                }

                            ?>        
                   <br>

    /// THE Problem!! a form for inserting customer to a new list


                     <li>
                            <form action="posts.php" method="get">
                                <div class="input-group">
                                    <input class="form-control" type="hidden" name="source" value="posts_list">
                                    <input type="hidden" name="cust_fs_id" value="<?php echo $customer_fs_id;?>">                           
                                    <input class="form-control" type="text" name="addto" placeholder="Προσθηκη σε νεα λίστα">
                                    <span class='input-group-btn'> 
                                    <button class='btn btn-primary' type="submit"><span class='glyphicon glyphicon-plus'></span></button></span>
                                </div>
                            </form>
                        </li>    

                    </ul>



                    </h4>
                    </div>

                </td>



                    <?php


                } else {

                    $count = "-";


                    ?>

                    <td class="text-center">
                        <div class="dropdown"><h4>
                                <button class="btn btn-primary dropdown-toggle btn-xs" type="button" data-toggle="dropdown"><span class='glyphicon glyphicon-plus'></span><span class="caret"></span></button>
                                <ul class="dropdown-menu dropdown-menu-right">

                           <?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 "<li><a href='posts.php?source=posts_list&cust_fs_id=$customer_fs_id&addto=$customers_filters'>Προσθήκη σε <b>$customers_filters</b></a></li>";
                                }

                                ?>
                     </ul>
                                </h4>
                                </div>     

                      </td> 


                    <?php  } ?>
在我写这篇文章时,除了第一行之外,所有行的客户都可以很好地工作! 任何帮助都是有价值的


塔克斯

第一行的错误是什么?它是空的吗?你好,不,它不是空的。我没有发现任何错误。除了刷新页面,它什么都不做。我有第一行的数据。。。我在phpmyadmin上提交了包含第一行客户id、用户id等数据的表单后,运行了我正在使用的所有查询,我得到了正确的结果。出于某种原因,我认为只有在第一行提交表格时才有问题。。奇怪的是,我在同一个表上的另一个功能中使用了相同的代码和不同的输入,我没有遇到任何问题。。。