gpt4 book ai didi

php - 使用文本字段而不是提交按钮来传递数据

转载 作者:太空宇宙 更新时间:2023-11-04 16:05:02 24 4
gpt4 key购买 nike

我只是想知道是否有另一种方法可以使用文本字段而不是提交按钮从 php 传递表单,因为我想使用文本字段或密码发送我的更新数据,以便用户在键入后只输入文本字段这是如何我的代码看起来像

if(isset($_POST['textfield']))
{
echo "send data";
}

<input type = "text" id = "textfield">

最佳答案

在文本字段的 onblur 事件上执行 javascript 函数,并在其 blur 事件上提交您的表单。

<form id="form">
<input type = "text" id = "textfield" onblur="submitMe()">
</form>

<script>
function submitMe() {
$("#form").submit();
}
</script>

关于php - 使用文本字段而不是提交按钮来传递数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38804614/

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