Menu
I need to get a response from the viewer and keep it on screen for all time,
for others to see and until I physically remove it.
I have access to Mysql if required but would prefer a .txt file for storage.
If anyone can write me some code to cover the above it would be appreciated.
The displayed text does not have to remain in the same textarea, if it is
easier to display the .txt file in a scrolling box and at a different location
on the page then that’s ok.
Thanx…
[COLOR=”RoyalBlue”][I]They do say “Ignorance is Bliss” I find it a pain in the brain…
[code=php]<?
echo "<form action='?#bottom' method=post>
<input type='text' name='message'>
<input type='submit' value='comment'>
</form>";
if(isset($_POST['message'])){
$x = fopen("messages.txt", 'a');
fwrite ($x, str_replace("n", "", $_POST['message']);
fclose($x);
echo "message posted.";
};
if(file_exists("messages.txt")){
echo "<div style='display: block; height: 500px; width: 90%; overflow: scroll'>";
$lines = file('messages.txt');
foreach ($lines as $line) {
echo htmlspecialchars($line)."<br>n";
};
echo "<a name='bottom'></a></div>";
?>[/code]
[code=php]<?
echo "<form action='?#bottom' method=post>
<input type='text' name='message'>
<input type='submit' value='comment'>
</form>";
if(isset($_POST['message'])){
$x = fopen("messages.txt", 'a');
fwrite ($x, str_replace("n", "", $_POST['message']);
fclose($x);
echo "message posted.";
};
if(file_exists("messages.txt")){
echo "<div style='display: block; height: 500px; width: 90%; overflow: scroll'>";
$lines = file('messages.txt');
foreach ($lines as $line) {
echo htmlspecialchars($line)."<br>n";
};
echo "<a name='bottom'></a></div>";
};
?>[/code]
[code=php]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>textboxtest</title>
<link rel="stylesheet" href="http://www.wjcag.co.uk/stylesheet.css" type="text/css">
<style type='text/css'>
span.usr{
color: #FF0000;
}
</style>
</head>
<body>
<center><br><br>
<img border=1 src="http://www.wjcag.co.uk/images2/blubells.gif">
<br><br>
Dark Blue
Light Blue Pink
White <br><br>
Can you identify these Bluebells please.?<br><br>
What's the difference between a Bluebell and a Harebell.?<br><br>
<?
echo "<form action='?#bottom' method=post>
<input type='text' name='user'>
<input type='text' name='message'>
<input type='submit' value='comment'>
</form>";
if(isset($_POST['message']) && isset($_POST['user'])){
$x = fopen("messages.txt", 'a');
fwrite ($x, htmlspecialchars(str_replace("n", "", $_POST['user']))."n");
fwrite ($x, htmlspecialchars(str_replace("n", "", $_POST['message']))."n");
fclose($x);
echo "message posted.";
};
if(file_exists("messages.txt")){
echo "<div style='display: block; height: 500px; width: 90%; overflow: scroll'>";
$lines = file('messages.txt');
$i = 0;
foreach ($lines as $line) {
if($i == 0){
echo "<span class='usr'>$line</span>: n";
}else{
echo "$line<br>n";
};
$i++;
};
echo "<a name='bottom'></a></div>";
};
?>
</center>
</body>
</html>[/code]
0.1.9 — BETA 5.27