kokeroulis Posted January 22, 2009 Share Posted January 22, 2009 HelloI want to create a page in which if someone visits it after a few minutes to write a message.And the message will remain.Also what does the following command? <!-- name -->bla bla bla <!-- end name --> Link to comment Share on other sites More sharing options...
real_illusions Posted January 22, 2009 Share Posted January 22, 2009 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 More sharing options...
kokeroulis Posted January 22, 2009 Author Share Posted January 22, 2009 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 More sharing options...
jeffman Posted January 22, 2009 Share Posted January 22, 2009 Are you sure? http://www.w3schools.com/tags/tag_comment.asp Link to comment Share on other sites More sharing options...
justsomeguy Posted January 22, 2009 Share Posted January 22, 2009 Are you sure?Read thishttp://w3schools.invisionzone.com/index.php?showtopic=12509 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 More sharing options...
kokeroulis Posted January 23, 2009 Author Share Posted January 23, 2009 I want to make something like this http://w3schools.com/php/php_date.asp. But instead of type the date i want to type something else after a few minutes.BUT i want this to be type after i refresh the page.So it doesn't need any javascrit....I hope you understand now.... Link to comment Share on other sites More sharing options...
justsomeguy Posted January 23, 2009 Share Posted January 23, 2009 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 More sharing options...
kokeroulis Posted January 24, 2009 Author Share Posted January 24, 2009 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?Exactly.That is what i want to do.Is it able to do it only with php? Link to comment Share on other sites More sharing options...
murfitUK Posted January 24, 2009 Share Posted January 24, 2009 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 More sharing options...
justsomeguy Posted January 25, 2009 Share Posted January 25, 2009 For most things like this people typically use a Javascript function, either setTimeout or setInterval, to run some code after a certain amount of time. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.