JankaZ Posted April 3, 2010 Share Posted April 3, 2010 How ken i show post histori to 10 posts for example! You: Hello Bot: Hi You: Nice day Bot: Jes <form method="post"> Message: <input name="message" type="text" /> <br /> <input type="submit" value="Send Message" /> <?php $name =$_POST['name']; $message =$_POST['message']; if ( $message == "hello") { $return = "how are you?"; } if ($message == "good you?") { $return = "i am good"; } if ($message == "good") { $return = "thats cool"; } if ($message == "sad") { $return = "well why are u sad"; } if ($message == "sad you?") { $return = "im good, and why so sad?"; } if ($message == "fine") { $return = "fine, usually that measn your bored!"; } if ($message == "fine you?") { $return = "im good"; } ?> <br /> <? echo("$return"); ?> And ken i store questions and answers in txt file? if ken then how? Link to comment https://forums.phpfreaks.com/topic/197480-post-limit/ Share on other sites More sharing options...
jcbones Posted April 3, 2010 Share Posted April 3, 2010 http://www.php.net/manual/en/function.fopen.php http://www.php.net/manual/en/function.fwrite.php http://www.php.net/manual/en/function.fclose.php Link to comment https://forums.phpfreaks.com/topic/197480-post-limit/#findComment-1036509 Share on other sites More sharing options...
JankaZ Posted April 3, 2010 Author Share Posted April 3, 2010 how ken i place in this script to show history? Link to comment https://forums.phpfreaks.com/topic/197480-post-limit/#findComment-1036510 Share on other sites More sharing options...
jcbones Posted April 3, 2010 Share Posted April 3, 2010 To read from a file and return the last 10 lines: $file = 'file.txt'; $res = file($file); $count = count($res); for($i = ($count - 10); $i <= $count; $i++) { echo $res[$i]; } Link to comment https://forums.phpfreaks.com/topic/197480-post-limit/#findComment-1036511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.