Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 718897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:34:48+00:00 2026-05-14T05:34:48+00:00

What happens is that I’m able to add and delete records from form using

  • 0

What happens is that I’m able to add and delete records from form using jQuery and PHP scripts to MYSQL database, but I am not able to update data which was retrieved from the database. The file structure is as follows:

index.php is a file with jQuery functions where it displays form for adding new data to MYSQL using save.php file and list of all records are view without refreshing page (calling load-list.php to view all records from index.php works fine, and save.php to save data from form)

-> Delete is an function called from index.php to delete record from MySQL database (function calling delete.php works fine)

-> Update is an function called from index.php to update data using update-form.php by retriving specific record from MySQL table, (works fine)

Problem lies in updating data from
update-form.php to update.php (in
which update query is written for
MySQL)

I have tried in many ways – at last I had figured out that data is not being transferred from update-form.php to update.php; there is a small problem in jQuery AJAX function where it is not transferring data to update.php page. Something is missing in calling update.php page it is not entering into that page.

Please find the link below to download all files which is of 35kb (virus free assurance):

download mysmallform files in ZIPped format, including mysql query


<pre>
<body>
<div class="container">  
    <form id="submit" method="post">  
        <fieldset>  
            <legend>Enter Information</legend>  
            <label for="Name">Name    : </label>  
        <input id="name" class="text" name="name" size="20" type="text">
            <label for="gender">Gender : </label>  
            <input id="gender" class="text" name="gender" size="20" type="text">
            <label for="dob">DoB     : </label>  
            <input id="dob" class="date" name="dob" size="20" type="text">  <button> Add  </button>  
        </fieldset>
    </form>  
    <div class="name_list"></div>
    <div class="update_form"></div>  
</div>

<script type="text/javascript">
$(document).ready(function(){
    function loadList(){
        $.ajax({
            url: "load-list.php",
            cache: false,
            success : function(html){
                $(".name_list").html(html);
            }
        });
    }
    loadList();

    $("form#submit").submit(function() {
        // we want to store the values from the form input box, then send via ajax below
        var x=window.confirm("Are you sure you want to delete this item?")
        var name = $('#name').attr('value');
        var gender = $('#gender').attr('value');
        var dob = $('#dob').attr('value');
        if (x==true){
                     $.ajax({
                type: "POST",
                url: "save.php",
                data: "name="+ name +"& gender="+ gender +"& dob="+ dob,
                success: function(){
                    loadList();
                               }
                 });
                 }
        return false;
    });

    $(".delete_button").live("click", function(){
        //this deletes the row clicked on with an alert and then reloads the list
        var id = $(this).attr("id");
        var x=window.confirm("Are you sure you want to delete this item?")
        if (x==true){
            $.ajax({
                type: "POST",
                url: "delete.php",
                data: "id="+ id,
                success: function(){
                    loadList();
                }
            });
        }
        return false;
    });

    $(".update_button").live("click", function(){
        //this loads the update form
        var id = $(this).attr("id");
        $.ajax({
            url: "update-form.php",
            data: "id="+ id,
            cache: false,
            success: function(html){
                $(".update_form").html(html);
            }
        });
        return false;
    });

      $("#updateform").ajaxform("submit",function(){
    //$("form#update").live("submit",(function() {
    // we want to send via ajax and empty the html from the update_form element
        var name = $('#name_update').attr('value');
        var gender = $('#gender_update').attr('value');
        var dob = $('#dob_update').attr('value');
        var id = $('#id').attr('value');
        alert (name);
            $.ajax({

                url: "update.php",
                type: "POST",
                data: "name="+ name +"& gender="+ gender +"& dob="+ dob,
                error: function(){
                    alert('Error loading document');
                             },
                success: function(){
                alert (" i  am  in success below load list ");
                    $(".update_form").empty();
                    loadList();

                        }

            });
        return false;
    });
});
</script> </body>
</pre>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:34:49+00:00Added an answer on May 14, 2026 at 5:34 am

    I copy-pasted your code into a php file and get a “$ is not defined” error in javascript. I look at your code tells me that you have not included the jquery file. Try using firefox as the browser and firebug for debugger to avoid such minor issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It happens that, when writing some PHP code, I accidentally put a semicolon ;
I am trying to load a new view from a tableview:didSelectRowAtIndexPath: method that happens
What happens when I use an ObjectInputStream to read in a serialized object that
I have a table that contains form elements that I need to replace if
I'm having problems with an archive that I built using zipfile in Python. I'm
I want to display an animated arrow that goes back and forth (using flex
We have normal java files residing in the SVN. We have made some changes
I have a table of the sort: USER | PLAN | START_DATE | END_DATE
I have a strange problem and it would be nice if I could solve
I would like to understand the ServiceBehavior.ConcurrencyMode property. Consider the following code on service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.