我有一个用户选择公司和日期的表单。然后用户需要从数据库中选择一些库存并将记录 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>
请让我知道这是否有意义。如果不是,我会改变我的问题