繁体   English   中英

用户在文本框内按Enter键时更新MySQL数据库

[英]Update MySQL Database when user presses Enter inside TextBox

我正在使用PHP和MySQL,并希望在用户在文本字段中输入新值然后按Enter键时更新我的​​数据库。

有人知道这方面的任何教程/文章吗?

您可以在www.w3schools.com上找到很棒的教程和解释

这些是关于如何在PHP中与MySQL数据库交互的教程:
http://www.w3schools.com/php/php_mysql_update.asp

这些是有关如何与PHP中的活动网页进行交互的教程:
http://www.w3schools.com/php/php_post.asp

如果你将两者结合起来,就可以实现你想要的东西=)

是的w3schools你会得到所有的教程,并检测输入密钥新闻代码在这里:

 ***************************************************************************
 *Pressing the "ENTER Key" or the "RETURN Key" usually generates
 *two characters: i.e., the "carriage return" character followed by
 *the "line feed" character. Regular expressions will be used to
 *check this character combination to identify whether the "ENTER
 *Key" or the RETURN Key" is pressed or not.
****************************************************************************/


 if(this.Text.match(/\r\n/)) 
 {
  Alert("Enter is not allowed!\nPlease use the command button.");
  this.Text =  this.Text.replace( /\r\n/gi,""); 
 // good place to fire off a CommandButton
}

暂无
暂无

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

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