How do I echo a variable then delete everything on the page and repeatPHP sleep() inside loop not updating DBHow to flush output after each `echo` call?How to echo in PHP while the script is still executing?Unable to find the wrapper “https” - did you forget to enable it when you configured PHP?PHP flush problemReference - What does this error mean in PHP?PHP while with sleep loop not updating database until end of loopHow to see variable that is echoed from php file - jquery ajaxmy mails are not getting sent by php funtion mail()PHP doesn't echo until page loaded
Is current (November 2019) polling about Democrats lead over Trump trustworthy?
A variation on Caesar
Given an array A[] and a number x, check for pair in A[] with sum as x
Create virtual block device which writes to /dev/null
Is it a good idea to contact a candidate?
"Ich habe Durst" vs "Ich bin durstig": Which is more common?
My name causes an issue with any booking! (names end with MR and MRS)
What type of beer is best for beer battered fish?
Making Sandwiches
Spanning tree of a rectangular grid
What is the "opposite" of a random variable?
How to use FDE without needing to share the encryption password
Surfacing out of a sunken ship/submarine - Survival Tips
How do the Martian rebels defeat Earth when they're grossly outnumbered and outgunned?
Requirement for validity of a passport
Why use [FormalN]?
Is there any point in having more than 6 months' runway in savings?
What is the lowest level at which a human can beat the 100m world record (or: the presumed human limit) without using magic?
Can a Scourge Aasimar fly?
how to say "change from an old job to a new one"
What happened to Sophie in her last encounter with Arthur?
Completing the square to solve limit problems
What's the name of the role of characters who buff teammates?
Giving a talk on a different topic than what we discussed
How do I echo a variable then delete everything on the page and repeat
PHP sleep() inside loop not updating DBHow to flush output after each `echo` call?How to echo in PHP while the script is still executing?Unable to find the wrapper “https” - did you forget to enable it when you configured PHP?PHP flush problemReference - What does this error mean in PHP?PHP while with sleep loop not updating database until end of loopHow to see variable that is echoed from php file - jquery ajaxmy mails are not getting sent by php funtion mail()PHP doesn't echo until page loaded
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I've been trying to echo variables while the script is running. I've got that part to work. However, I want to delete everything on the page then echo and repeat. I've searched on stackoverflow, and tried their solutions, but it still doesn't work for me. Example:
- Delete everything on the page (so its blank).
- echo
$i
$i += 1
- Repeat
PHP Version: 7.2.10
Running on: XAMPP
script.php:
<?php
$i = 0;
while ($i < 999999999)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
What is happening is that the page is not deleting everything on the page so it ends up looking like:
09:00:00
0
09:00:01
01
09:00:02
012
I want it to be like this:
09:00:00
0
09:00:01
1
09:00:02
2
php xampp flush
|
show 5 more comments
I've been trying to echo variables while the script is running. I've got that part to work. However, I want to delete everything on the page then echo and repeat. I've searched on stackoverflow, and tried their solutions, but it still doesn't work for me. Example:
- Delete everything on the page (so its blank).
- echo
$i
$i += 1
- Repeat
PHP Version: 7.2.10
Running on: XAMPP
script.php:
<?php
$i = 0;
while ($i < 999999999)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
What is happening is that the page is not deleting everything on the page so it ends up looking like:
09:00:00
0
09:00:01
01
09:00:02
012
I want it to be like this:
09:00:00
0
09:00:01
1
09:00:02
2
php xampp flush
2
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressingF12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?
– Ross
Mar 28 at 22:08
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33
|
show 5 more comments
I've been trying to echo variables while the script is running. I've got that part to work. However, I want to delete everything on the page then echo and repeat. I've searched on stackoverflow, and tried their solutions, but it still doesn't work for me. Example:
- Delete everything on the page (so its blank).
- echo
$i
$i += 1
- Repeat
PHP Version: 7.2.10
Running on: XAMPP
script.php:
<?php
$i = 0;
while ($i < 999999999)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
What is happening is that the page is not deleting everything on the page so it ends up looking like:
09:00:00
0
09:00:01
01
09:00:02
012
I want it to be like this:
09:00:00
0
09:00:01
1
09:00:02
2
php xampp flush
I've been trying to echo variables while the script is running. I've got that part to work. However, I want to delete everything on the page then echo and repeat. I've searched on stackoverflow, and tried their solutions, but it still doesn't work for me. Example:
- Delete everything on the page (so its blank).
- echo
$i
$i += 1
- Repeat
PHP Version: 7.2.10
Running on: XAMPP
script.php:
<?php
$i = 0;
while ($i < 999999999)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
What is happening is that the page is not deleting everything on the page so it ends up looking like:
09:00:00
0
09:00:01
01
09:00:02
012
I want it to be like this:
09:00:00
0
09:00:01
1
09:00:02
2
php xampp flush
php xampp flush
asked Mar 28 at 21:59
RossRoss
406 bronze badges
406 bronze badges
2
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressingF12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?
– Ross
Mar 28 at 22:08
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33
|
show 5 more comments
2
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressingF12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?
– Ross
Mar 28 at 22:08
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33
2
2
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressing
F12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?– Ross
Mar 28 at 22:08
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressing
F12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?– Ross
Mar 28 at 22:08
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33
|
show 5 more comments
2 Answers
2
active
oldest
votes
Try this out, using JS to clear the page during the while loop
$i = 0;
while ($i < 10)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
echo "<script type='text/javascript'>";
echo "document.body.innerHTML = ''";
echo "</script>";
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
|
show 2 more comments
if I not wrong, only way to achive this is javascript or CSS because "output" in PHP is always show in client side, and as you know well, PHP doesn't change anything in client side.
<?php
$i = 0;
while ($i < 999999999)
echo '<div style="position:absolute;margin-left:0;margin-top:0;background:white;width:15px;"> </div>'; // to clean
echo '<div style="position:absolute;margin-left:0;margin-top:0">'.$i.'</div>'; // to show in same place.
flush();
ob_flush();
sleep(1);
$i += 1;
?>
In any case, hope this help for you.
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55407490%2fhow-do-i-echo-a-variable-then-delete-everything-on-the-page-and-repeat%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this out, using JS to clear the page during the while loop
$i = 0;
while ($i < 10)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
echo "<script type='text/javascript'>";
echo "document.body.innerHTML = ''";
echo "</script>";
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
|
show 2 more comments
Try this out, using JS to clear the page during the while loop
$i = 0;
while ($i < 10)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
echo "<script type='text/javascript'>";
echo "document.body.innerHTML = ''";
echo "</script>";
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
|
show 2 more comments
Try this out, using JS to clear the page during the while loop
$i = 0;
while ($i < 10)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
echo "<script type='text/javascript'>";
echo "document.body.innerHTML = ''";
echo "</script>";
Try this out, using JS to clear the page during the while loop
$i = 0;
while ($i < 10)
echo $i;
flush();
ob_flush();
sleep(1);
$i += 1;
echo "<script type='text/javascript'>";
echo "document.body.innerHTML = ''";
echo "</script>";
answered Mar 28 at 22:46
RalphRalph
2272 silver badges10 bronze badges
2272 silver badges10 bronze badges
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
|
show 2 more comments
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
isn't this going to print the js part a lot and the html code will be filled with this code? Hence, taking up a lot of ram?
– Ross
Mar 28 at 22:54
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross A lot of RAM? Not on the server side, not at all and on the client side, well, today's computers have many gigabytes of RAM. Above code would sum up to roughly 1 kilobyte...
– arkascha
Mar 28 at 23:03
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
@Ross I don't know about that ngl but I don't think it'll take up too much as it's very simple code. What you're asking for is weird and I don't see many other ways to do it tbh.
– Ralph
Mar 28 at 23:05
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
I think you're worried about the wrong things @Ross - websites ship down more javascript than ever before these days.
– Derek Pollard
Mar 28 at 23:09
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
This code will show you a white screen - php is a server side languge and show only the result.
– Maksim
Mar 28 at 23:36
|
show 2 more comments
if I not wrong, only way to achive this is javascript or CSS because "output" in PHP is always show in client side, and as you know well, PHP doesn't change anything in client side.
<?php
$i = 0;
while ($i < 999999999)
echo '<div style="position:absolute;margin-left:0;margin-top:0;background:white;width:15px;"> </div>'; // to clean
echo '<div style="position:absolute;margin-left:0;margin-top:0">'.$i.'</div>'; // to show in same place.
flush();
ob_flush();
sleep(1);
$i += 1;
?>
In any case, hope this help for you.
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
add a comment
|
if I not wrong, only way to achive this is javascript or CSS because "output" in PHP is always show in client side, and as you know well, PHP doesn't change anything in client side.
<?php
$i = 0;
while ($i < 999999999)
echo '<div style="position:absolute;margin-left:0;margin-top:0;background:white;width:15px;"> </div>'; // to clean
echo '<div style="position:absolute;margin-left:0;margin-top:0">'.$i.'</div>'; // to show in same place.
flush();
ob_flush();
sleep(1);
$i += 1;
?>
In any case, hope this help for you.
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
add a comment
|
if I not wrong, only way to achive this is javascript or CSS because "output" in PHP is always show in client side, and as you know well, PHP doesn't change anything in client side.
<?php
$i = 0;
while ($i < 999999999)
echo '<div style="position:absolute;margin-left:0;margin-top:0;background:white;width:15px;"> </div>'; // to clean
echo '<div style="position:absolute;margin-left:0;margin-top:0">'.$i.'</div>'; // to show in same place.
flush();
ob_flush();
sleep(1);
$i += 1;
?>
In any case, hope this help for you.
if I not wrong, only way to achive this is javascript or CSS because "output" in PHP is always show in client side, and as you know well, PHP doesn't change anything in client side.
<?php
$i = 0;
while ($i < 999999999)
echo '<div style="position:absolute;margin-left:0;margin-top:0;background:white;width:15px;"> </div>'; // to clean
echo '<div style="position:absolute;margin-left:0;margin-top:0">'.$i.'</div>'; // to show in same place.
flush();
ob_flush();
sleep(1);
$i += 1;
?>
In any case, hope this help for you.
answered Mar 28 at 22:46
Sebastian P.Sebastian P.
761 bronze badge
761 bronze badge
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
add a comment
|
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
If I do this, this will chew up the client's ram up pretty fast
– Ross
Mar 28 at 22:53
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
this cuestion is look like a "homework" but this is not my concern. Wherever.. I think this is not achive with only PHP, because you know, only control server side, not output place (client side).
– Sebastian P.
Mar 28 at 23:14
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55407490%2fhow-do-i-echo-a-variable-then-delete-everything-on-the-page-and-repeat%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Ross - flushing data does exactly that - nothing in the script would clear the display. For that, you might want to look into something like Javascript with ajax so you can communicate with your PHP backend
– Derek Pollard
Mar 28 at 22:01
@DerekPollard Is there any function in php that would do it?
– Ross
Mar 28 at 22:03
No, that would be something for javascript to handle. Unless you had PHP just simply refreshing the paging every X seconds, which I don't recommend
– Derek Pollard
Mar 28 at 22:04
@DerekPollard sorry, this question is a little off topic but you just made me very concerned. Javascript is executed client side. That means using Javascript I can call PHP functions. Does this means people can edit the source code (using Google Chrome by pressing
F12
, then editing code in the elements section) and execute any of my php functions, if they figure out my php function's name?– Ross
Mar 28 at 22:08
php runs on the server side. That means the client gets only what you send to them. plain text, html files, json, or what ever you want. That means,when the content gets once send to the client there is no way for the server to clear the display/page on the client side. If you want to change the content of the page, use ajax calls from js to your webserver for receiving the content you want.
– Marc
Mar 28 at 22:33