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.

2
  • 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. Commented Dec 24, 2011 at 20:19
  • I think you're mising the programming language/platform you use for your front-end/web? Commented Dec 24, 2011 at 20:20

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.