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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:22:41+00:00 2026-06-18T08:22:41+00:00

I ran into a little problem with my college project again :( <input type=text

  • 0

I ran into a little problem with my college project again 🙁

<input type="text" name="timrem" value="" />

This is a hidden field that I want the data from.

if(isset($_REQUEST['timrem']))
{
    $tim=$_REQUEST['timrem'];
}

This is the code used to get the value from timrem.
The variable timrem is used to initialize a countdown sequence on the page(implemented using javascript)

<span id="countdown-1" style="float:right"><?php echo $tim;?>

The value of the hidden field is dynamically changed via java script counter implemented.

sremtime=(parseInt(minRemain*60)) + (parseInt(secsRemain));
document.frmTest.timrem.value=sremtime;

this works fine when the page is submitted, ie, the time doesn’t restart from the next page. But when the page is refreshed, the timer is restarted to the value of the $tim when the timer first started.

Is it possible to somehow get the value of the hidden input on page refresh?

And also, please comment on the approach taken to preserve the time elapsed to the next page. This is a project on online examination.

  • 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-06-18T08:22:42+00:00Added an answer on June 18, 2026 at 8:22 am

    If you need your variable to persist across refreshes, you cannot rely on information passed back from client to server. The only information you can rely on is the information passed with the very first request, and that obviously doesn’t include your time. The best solution I can think of is to store your timestamp in a session variable on the server:

    session_start();
    if(empty($_SESSION['timrem'])) $_SESSION['timrem'] = time(); // set this if it is the first time this page is loaded
    $tim = time() - $_SESSION['timrem']; // $tim is now the number of seconds since the page was first loaded in this session
    

    You do not need to pass the time back and forth between client and server to keep track of it, although your javascript will probably need it.

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

Sidebar

Related Questions

Ran into a little problem and I'm not entirely sure why this code won't
I ran into something a little odd this morning and thought I'd submit it
I ran into a little problem today when I was creating a really quick
I ran into this quite often stated problem but even after looking up nearly
I am taking practice exercises and ran into this issue. This problem asks: Prompt
I ran into a little problem and need some help: If I have an
I ran into a little problem today that I can't seem to solve in
I'm working on a little project for fun and ran into some trouble trying
I ran into a little problem I have a has_many through relationship here is
When I was working on a little project I ran into a delema 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.