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 6210019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:05:16+00:00 2026-05-24T06:05:16+00:00

I have a form in that i am getting the initial value of form

  • 0

I have a form in that i am getting the initial value of form from mysql and then javascript changes the value (every second that value increases by 1 ) but when i submit the form it submits the initial value what i have got from mysql .

please tell how to submit the updated value for example if i have retrieved 40 as form value from MySQL then it keeps on increasing but as in form value is coming from MySQL when i submit it submits 40 only but in actual my form value increases every second please tell how to submit updated value in MySQL. here is my code.

  • 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-24T06:05:17+00:00Added an answer on May 24, 2026 at 6:05 am

    I realized your problem: You are fetching the value before the UPDATE, so you are always getting the old value. Make sure you run the SELECT after the UPDATE so you can get the new value. Try something like this:

    // Only update if a value was posted
    if (isset($_POST['Time_Spent1']))
    {
        // Cast to integer or use mysql_real_escape_string() here to protect the query
        $new_value = (integer) $_POST['Time_Spent1'];
        sql_query( "update jcow_accounts set Time_Spent = '{$new_value}' where id = '{$client['id']}' " );
    }
    
    // Run SELECT afterwards, in case the value was updated
    $res = sql_query("select * from jcow_accounts where id='{$client['id']}'");
    
    $row = sql_fetch_array($res);
    
    $Time = $row['Time_Spent'];
    
    echo '<form name="form1" method="post" action="">
    <p>Earning: <input name="Time_Spent1"  value="'.$Time.'" id="Time_Spent1"   type="text" size="7"  /></p>
    <input type="submit" name="Submit" value="submit" />
    </form>'
    

    So, it was nothing to do with the $_POST value, the value that you used to repopulate the form input from the database was “old”. There’s plenty of other things I could nitpick about the code, and I’m tempted to, but this should get you moving forward.

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

Sidebar

Related Questions

This is really getting to me now.I have a form that loads when the
I currently have form that checks if a user has unsubmitted changes when they
I have a web-form that is getting customer information. The form is processed using
I have a form that can be manipulated on the client's browser via javascript
I have a form that is loading quite an amount of data from SQL
I have a signup form that needs to be loaded for every page of
I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
We have a form that hosts the WebBrowser control. That is the only control
I have a form that can open a sub form (with ShowDialog ). I
I have a form that and after the user fills in this form, I

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.