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

  • SEARCH
  • Home
  • 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 7499389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:48:40+00:00 2026-05-29T19:48:40+00:00

This is my form. If i click the status content like progress or dsgs

  • 0

This is my form.

enter image description here

If i click the status content like progress or dsgs a textfield should appear. If i type text in it and click outside or press enter the old content should updated with the new one. I need it to be done with ajax and php. I am a beginner in php and ajax. Any reference or how can i do this?

This is my code for add status

$insert_task = "INSERT INTO `tbl_task` (`intProjectid`,`intUserid`,`dtDate`,`dtFinishdate`,`varIssue`,`varStatus`,`varNeedhelp` )VALUES ('".$id."','".$userid."','".$dtdate."','".$dtfinish."','".$issue."','".$status."','".$help."');";
$insert_query=mysql_query($insert_task);
  • 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-29T19:48:43+00:00Added an answer on May 29, 2026 at 7:48 pm

    You didn’t give me anything but I’ve tried to implement something by guessing and hope if it doesn’t solve your problem but at least it will help you. Following code is for your ajax functionality, you can put it inside the head tag of your page between script tags-

            $(document).ready(function(){
                var eventFlag=false;
                var originalText='';
                $('#mytable tr td span').click(function(e){
                    e.stopImmediatePropagation();
                    $(this).siblings().show().focus();
                    $(this).hide();
                    eventFlag=false;
                    originalText=$(this).siblings().val();
                });
    
                $('#mytable tr td input').blur(function(e){
                    if(!eventFlag && validate($(this))) doAjax($(this));
                    else
                    {
                        $(this).siblings().show();
                        $(this).hide();
                    }
                });
    
                $('#mytable tr td input').keypress(function(e){
                    e.stopImmediatePropagation();
                    var code = (e.keyCode ? e.keyCode : e.which);
                    if(code==13)
                    {
                        if(validate($(this)))
                        {
                            doAjax($(this));
                            eventFlag=true;
                        }
                        else
                        {
                            $(this).siblings().show();
                            $(this).hide();
                        }
                    }
                });
    
                function validate(input)
                {
                    console.log(input.val()+" "+originalText);
                    if(input.val()!='' && input.val()!=originalText)
                    return true
                    else return false;
                }
    
                function doAjax(input)
                {
                    var formData="proId="+input.attr('id')+"&text="+input.val();
                        $.ajax({
                            type: "POST",
                            url: "update.php",
                            data: formData,
                            success: function(data){
                                if(data==1) 
                                {
                                    input.siblings().text(input.val()).show();
                                    input.hide();
                                }   
                                else
                                {
                                    input.siblings().show();
                                    input.hide();
                                    alert("something Wrong !");
                                }   
                            },
                            error:function (xhr, ajaxOptions, thrownError){
                                alert("Error:"+xhr.status+" "+thrownError);
                            }
                        });
                }
    
            });
    

    And I guessed your form could be something like this

    <form action="#" method="post">
            <table id="mytable">
                <thead>
                    <tr>
                        <th>Issue</th><th>Status</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Login</td><td id="1"><span>Progress</span><input id="1" type="text" value="Progress" /></td>
                    </tr>
    
                    <tr>
                        <td>Something Else</td><td id="2"><span>Anything</span><input id="2" type="text" value="Anything"/></td>
                    </tr>
                </tbody>    
            </table>
        </form>
    

    Put this inside your head or stylesheet (without style tag)

    <style>
            #mytable tr td input{display:none;}
    </style>
    

    And your update.php file should be something like

    <?php
    
    $proId = $_POST['proId'];
    $text = $_POST['text'];
    $update_task="update tbl_task set varStatus='".$text."' where intProjectid=".$proId;
    if(mysql_query($update_task))
    {
        echo "1";
    }
    else 
    {
        echo "0";
    }   
    
    ?>
    

    I’ve tested it and working. The id I’ve used in the form is by assuming that you have id’s for each of your status and you should update instead of inserting to change the status. let me know if it helps or if you need more help, I’ll be on touch. Thanks!

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

Sidebar

Related Questions

When click a button,I want to popup a view form bottom,like this! Any help
Particularly the bit about live.... jQuery('.something').live('click', function() { jQuery(this).parent('form').reset(); }); I suppose this might
is it better to do this (regarding performance, not readability...): $('a.updateCartButton').click(function() { $('form[name=updateCartForm]').attr('action', $(this).attr('href')
My html of form is like this <form id=form method=post action=func.php> <table> <!--- DATA
This is an ajax function that i would like carry out on click of
On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load(/Users/mge/Downloads/jquery-ajax-1/readme.txt); return false; });
I have data in this form, Article ID Company A Company B Company C
I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
I have this form: <form name=customize> Only show results within <select name=distance id=slct_distance> <option>25</option>
I am using this form as a file upload form(as part of a larger

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.