gpt4 book ai didi

php - 两个相关的下拉列表和文本区域(4 个文本区域)取决于 mysql 的最后一个下拉列表

转载 作者:行者123 更新时间:2023-11-29 03:26:33 24 4
gpt4 key购买 nike

enter image description here

第一个下拉选择与表不同第二个下拉列表从表中选择子类别,其中类别类似于第一个下拉列表

然后在选择第二个下拉列表后,4 个文本字段也必须自动填充数据

请帮忙

我的PHP:

global $wpdb; 
$rows = $wpdb->get_results("SELECT DISTINCT article from wp_rpci_description");
echo "<label id='select'><select name='article'>";
foreach ($rows as $row
{
echo "<option>$row->article</option>";
}
echo "</select></label>";

还有我的html:

<tr>
<th>Description</th>
<td>
<select name='article'>
<option>
<?php echo $description;?>
</option>
</select>
</td>
</tr>
<tr>
<th>Stocknumber</th>
<td>
<input type="text" name="stocknumber" value="<?php echo $stocknumber;?>" />
</td>
</tr>
<tr>
<th>Unit of Measure</th>
<td>
<input type="text" name="unitofmeasure" value="<?php echo $unitofmeasure;?>" />
</td>
</tr>
<tr>
<th>Unit Value</th>
<td>
<input type="text" name="unitvalue" value="<?php echo $unitvalue;?>" />
</td>
</tr>
<tr>
<th>Balance per Card (Quantity)</th>
<td>
<input type="text" name="balancepercard" value="<?php echo $balancepercard;?>" />
</td>
</tr>
<tr>
<th>Onhand per Count (Quantity)</th>
<td>
<input type="text" name="onhandpercount" value="<?php echo $onhandpercount;?>" />
</td>
</tr>
<tr>
<th>Shortage/Overage Quantity</th>
<td>
<input type="text" name="soquantity" value="<?php echo $soquantity;?>" />
</td>
</tr>
<tr>
<th>Shortage/Overage Value</th>
<td>
<input type="text" name="sovalue" value="<?php echo $sovalue;?>" />
</td>
</tr>
<tr>
<th>Remarks</th>
<td>
<textarea name="remarks">
<?php echo $remarks;?>
</textarea>
<input type="hidden" name="userids" value="<?php echo $user_id;?>" />
</td>
</tr>

</table>

最佳答案

调用 ajax 请求更改第二个下拉列表,

$('#dropdown2_id').live('change', function(event) {
var dropdown1=$(this).val();
var dropdown2=$("#dropdown1").val();
$.ajax({
url:"filename.php",
type: "POST",
data:{'dropdown1':dropdown1,'dropdown2':dropdown2},
success: function(data){
$('.input-class').val(data);
}
});

关于php - 两个相关的下拉列表和文本区域(4 个文本区域)取决于 mysql 的最后一个下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35308008/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com