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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:38:39+00:00 2026-06-03T06:38:39+00:00

hello i have been searching for some php code that is something like element.innerHTML

  • 0

hello i have been searching for some php code that is something like element.innerHTML in javascript but i can’t find it. i need it for some code that for example goes from 1-60 in 60 seconds
but if i do that with echo it just places everything under each other and that should not happen. i need something that just replaces the text. i also don’t want to reload my page every second and i don’t have the ability to write to files ( i can read them). and please don’t tell me that i should do it in javascript.
so can someone tell me how to do this?

  • 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-03T06:38:41+00:00Added an answer on June 3, 2026 at 6:38 am

    You can use PHP to spit out javascript that does the replacing. There won’t be a pure PHP solution to this since PHP is server-side and doesn’t have access to the rendering of the page on the client side.

    Suppose the text you need to change is in a <div> tag named ‘replaceMe’. You will want to use the ob_flush() functions in PHP to force out the javascript at the time you need it to display. The PHP to initialize that is

    if (ob_get_level() == 0) ob_start();
    

    Then, each time you need to update, you have something like this in your PHP code that adds to the body of the page:

    echo '<script type="text/javascript" language="javascript">';
    echo "document.getElementById('replaceMe').innerHTML = 'Text for this iteration';";
    echo '</script>';
    flush(); ob_flush();
    

    Of course if you want to make it easier for yourself, you can make a PHP function to print all this out given an argument containing the text to replace.

    Then at the end you need to have

    ob_end_flush();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help. I have been searching and encountered/modified this code I am
Hello Guys! See I have been creating a code powered with ajax but it
Hello I've been searching for a web hosting site that enables php frameworks, e.g.
Hello guys, I have been trying to implement the DSUM function but failed to
Hello I have been tasked with creating a fairly complex web application in php,
Hello i have been trying to find a tutorial that show how to setup
Hello I have been trying to format this date but it keeps giving me
$(#profile_bar).mouseover(function(){ <?php $_SESSION['sessionasdf'] = 'asdf'; ?> }); Hello! I have been busy with this
Hello fellow programmers I have been searching the internet for a few days now
Hello I have been working for a while with PHP and MySQL. Now 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.