html中的输入框元素:
<input id="passwordfield" type="password" class="DefaultInputStyle">
html中的button元素:
<button class="DefaultButtonStyle" onclick="trylogin(passwordfield.value)" ">登录</button>
html中的script脚本内容:
<script>
function trylogin(str) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("usernamefield").value = "successful";
}
}
xmlhttp.open("GET", "CheckUserNameAndPassword.php", true)
xmlhttp.send();
}
</script>
SQLServer的udl文件属性:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=12345;Persist Security Info=True;User ID=sa;Initial Catalog=Diary;Data Source=DESKTOP-LBLP1PJ\SQLEXPRESS01
SQL数据库中的表和内容
如果我想要在点击按钮时,将输入框中的文本作为name,查找数据库中匹配的value值并重写进输入框,那么php文件的代码该怎么写呢?