Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用AJAX下拉字段搜索并添加到数组以实时显示结果_Php_Mysql_Ajax - Fatal编程技术网

Php 使用AJAX下拉字段搜索并添加到数组以实时显示结果

Php 使用AJAX下拉字段搜索并添加到数组以实时显示结果,php,mysql,ajax,Php,Mysql,Ajax,我有一个表单,用户可以在其中选择公司和日期。然后,用户需要从数据库中选择一些清单,并将记录id添加到数组中以供以后使用。我的想法是简单地获取每个库存项目的id,并将其传递给一个数组,以便稍后我可以循环使用该id插入mysql。我希望能够让用户从字段中搜索库存,然后结果显示在该字段下方,然后用户可以选择特定的库存项目。当他们单击/选择它时,它会将该记录id添加到一个数组中,我可以稍后使用该数组 <form action="" method="post"> <div>

我有一个表单,用户可以在其中选择公司和日期。然后,用户需要从数据库中选择一些清单,并将记录id添加到数组中以供以后使用。我的想法是简单地获取每个库存项目的id,并将其传递给一个数组,以便稍后我可以循环使用该id插入mysql。我希望能够让用户从字段中搜索库存,然后结果显示在该字段下方,然后用户可以选择特定的库存项目。当他们单击/选择它时,它会将该记录id添加到一个数组中,我可以稍后使用该数组

<form action="" method="post">
    <div>
    <select>
        <option>Company 1</option>
        <option>Company 2</option>
    </select>
    </div>
    <div>
        <input type="text" name="date">
    </div>
    <div>
        <input type="text" name="search">
        // Here is where I need to display the results from the db based on what the user typed in a drop down, then when that user selects that item then it will add that records id to an array. Then I need the array to display below and how the records based on the id. 
    </div>
    <div>
    // The array is shown here and as the user selects multiple items. It might look something like this
    <? $thisarray = array() - as users select items from drop down then the records ids are added to the array. Then as they are added to the array I can use a mysql SELECT to display those records. Then when the user submits the form I can pass that array as well.
    </div>
</form>

请让我知道这是否有意义。如果不是,我将更改我的问题

如果您的序列号可以是字符串,也许您可以使用带有前缀的uuid通用唯一标识符


你的问题是什么?你尝试过什么,但什么不起作用?我有一个帖子,在这个自动填充的探索中,我已经走得更远了。请按照这条线索来更好地了解我指的是什么。