简体   繁体   English

如何使用php和html基于组合框选择中的更改自动更改输入文本框的值

[英]How to automatically change values of input text box based on change in combo box selection using php and html

Lets say there is a combobox with 3 values:a,b,c. 可以说有一个带有3个值的组合框:a,b,c。 There are also 3 text boxes. 还有3个文本框。 There is a database with 1 table which contains 4 columns. 有一个包含1个表的数据库,其中包含4列。 Now, how exactly can I update the values of the 3 inputboxes whenever I select a different value in the combobox. 现在,每当我在组合框中选择其他值时,如何精确地更新3个输入框的值。 Lets say combobox represents the data in column 1 of the database table, textbox1 reporesents data for column 2, textbox2 for column3 and textbox3 for column4, so that the values of the text input boxes changes accordingly. 假设combobox代表数据库表第1列中的数据,textbox1代表第2列的数据,textbox2代表column3的数据,textbox3代表column4的数据,因此文本输入框的值会相应更改。

I am really sorry for being vague. 我很抱歉含糊。 Hope someone can still help me out. 希望有人还能帮助我。 This has to be done using php html ajax and mysql. 这必须使用php html ajax和mysql完成。

this has to be done in javascript mainly. 这必须主要在javascript中完成。 something like this (no valid code just mockup) 像这样的东西(没有有效的代码只是样机)

<select onchange="changeInputBoxes(this)"...> .... </select>
<script>
function changeInputBoxes(){
document.getElementById("inputid").value = this.value;
...
}
</script>

but its really to vague. 但它确实含糊不清。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM