Jump to content

Ajax 'Add New Contact' Button


newphper

Recommended Posts

Hi Guys,

 

I'm brand new to AJAX, trying to find my feet and am obviously having some trouble doing so.

I have a PHP form, it is quite long.

On one part of the form I ask for contact information.

I have a name textarea, a surname textare and some checkboxes regarding occupation.

After the person has filled this part of the form in, I would like them to either leave it as is OR press the 'Add New Contact' button which will not refresh the page, but will submit the entered data to my database and allow them to continue with the rest of the form.

 

Anything will help, even if you can point me to a good tutorial?

Thanks!!

Link to comment
Share on other sites

Take a look at my post here:

 

http://www.phpfreaks.com/forums/index.php/topic,287155.0.html

 

 

I was trying to accomplish something similar -- I wanted to be able to add/delete rows in a MySQL table.  The rows in that table are displayed in an HTML table.  However, when the add/delete was executed, I wanted the page to update the HTML table without having to do a full refresh.  You can probably tweak my code there (get rid of the if statements since you can assume it's an addition, and then remove the stuff at the bottom of the PHP code that displays the table.  Instead, you could just display a "success" message), or at least get a good idea of how to do things.

 

The AJAX request is sent over using HTTP GET.  I'm about to create a new thread that shows how to transform a GET request into a POST request.  It might be useful to check that out too.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.