开发者

Update MySQL Database when user presses Enter inside TextBox

开发者 https://www.devze.com 2023-01-26 05:39 出处:网络
I am working with PHP and MySQL, and would like to update my database when a user enters a new value in a textfield and then presses enter.

I am working with PHP and MySQL, and would like to update my database when a user enters a new value in a textfield and then presses enter.

And does anyone know of any tutorials/arti开发者_Python百科cles on this?


You can find great tutorials and explanation on www.w3schools.com

These are tutorials on how to interact with a MySQL database in PHP:
http://www.w3schools.com/php/php_mysql_update.asp

And these are tutorials on how to interact with an active web page in PHP:
http://www.w3schools.com/php/php_post.asp

If you combine the two, you can achieve what you're looking for =)


Yeh on w3schools you will get all tutorials and to detect enter key press code is here:

 ***************************************************************************
 *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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号