Jump to content

Time And Other Questions


kokeroulis

Recommended Posts

The above doesnt do anything, the <!-- name --> parts are comments and wont show up on the page. The 'bla bla bla' part is where you put anything you want, html code, php code etc etc...To have a 'welcome back' message, you need to look into cookies - http://www.w3schools.com/php/php_cookies.asp

Link to comment
Share on other sites

The above doesnt do anything, the <!-- name --> parts are comments and wont show up on the page. The 'bla bla bla' part is where you put anything you want, html code, php code etc etc...To have a 'welcome back' message, you need to look into cookies - http://www.w3schools.com/php/php_cookies.asp
I don't want to do this with cookies.First of all if visit the above page it will type "hello"
<?phpecho "hello";?>

Now i want to edit this page and if i visit it, it will display the "hello" after a few minutes....I think that i have to use the command if and one other but i don't which.(I don't want to put any javascript.The "Hi" will be display after the refresh of the page.)i hope you understand now....

The above doesnt do anything, the <!-- name --> parts are comments and wont show up on the page. The 'bla bla bla' part is where you put anything you want, html code, php code etc etc...

Are you sure?Read this

http://w3schools.invisionzone.com/index.php?showtopic=12509

Link to comment
Share on other sites

If you're referring to this example:
<!-- this is sent to the browser as output --><?phpecho "send more output";?>

I was just trying to make the point that even HTML comments count as output sent to the browser.I'm not sure exactly what you're asking, but if you want to be able to edit the text that shows up on a page you're going to need to store that text somewhere, either in a database or a text file. You can use PHP to read the text from the DB or file and put it on the page, and also to get the new text and write it back to the DB or file.

if i visit it, it will display the "hello" after a few minutes....
Are you saying that you want to load the page, then after a few minutes go by some new words appear on it? That would be done with Javascript, not PHP.
Link to comment
Share on other sites

I'm still not real clear. PHP's date function just formats a date. I'm not sure how that relates to what you're asking for.Specifically, I'm not sure what you mean by "after a few minutes", you keep saying that. Are you trying to set up a timer to make something happen a few minutes after the page loads? Do you just want a page where you have a text box or something to type something into, and when you press submit it replaces the text on the page with what you typed? Are you looking for a guestbook or something like that?

Link to comment
Share on other sites

Not really something you can do with php. php scripts run when called up from your browser. Once it has run and has sent its output back to your browser, the script ends. Full stop.You can try to get your browser to run the script again by putting a "refresh" in the header. It will work with html pages - doesn't need to be php. The number is in seconds.

Filename: page.php<html><head><META HTTP-EQUIV="refresh" CONTENT="60; URL=page.php"></head><body><p>This page will refresh every 60 seconds.</p><?php//put some php stuff here?></body></html>

You could add to the link something like page.php?a=1 and then within the php section use $_GET['a'] to find out if a has been included in the link. If not, display the page for the first time. If it is included, do something else.

Filename: refreshtest.php<html><head><META HTTP-EQUIV="refresh" CONTENT="5; URL=refreshtest.php?a=1"></head><body><?phpif (!isset($_GET['a'])){print "<p>This is the first time this page has been displayed.</p>";}else{print "<p>This page has run before.</p>";}?></body></html>

This won't remember if a visitor comes back to this page by typing refreshtest.php into the browser again. It will only run the second bit of code if there is a ?a= bit at the end. The refresh header calls the same page and puts the ?a= bit at the end.I really am not sure what you are trying to do but maybe this will help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...