0

What is the most simple way to insert values into a mysql database without reloading the page? In this particular example, I'd like to have a form with one input field, and when the form is submitted, the user's input to the field is inserted into a mysql database table, but the page is not reloaded.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Proffesor
  • 2,489
  • 5
  • 24
  • 26
  • You would have to submit the data via Ajax. Once the browser itself submits the form it is expecting a response from the server with a new page to be displayed. – Jim Garrison Dec 24 '11 at 20:19
  • I think you're mising the programming language/platform you use for your front-end/web? – rene Dec 24 '11 at 20:20

3 Answers3

1

You can use AJAX to send content to a server side file (without reloading) and that file can insert row(s) in the database. Here's an example : http://www.9lessons.info/2009/08/vote-with-jquery-ajax-and-php.html Here, this guy creates a digg like vote button and it inserts and updates rows without reloading the page. Check it out.

Abhishek Biswal
  • 450
  • 5
  • 18
0

Look at jquery ajax() or the jquery.form() plugin.

Jens Alm
  • 3,027
  • 4
  • 22
  • 24
0

This requires AJAX.

You CAN do this with plain JS, but jQuery makes your life a lot easier.

See this post for a good example:

Inserting into MySQL from PHP (jQuery/AJAX)

Community
  • 1
  • 1
Derk Arts
  • 3,432
  • 2
  • 18
  • 36