Reputation:
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/articles on this?
Upvotes: 0
Views: 1080
Reputation: 1466
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
}
Upvotes: 0
Reputation: 8269
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 =)
Upvotes: 2