View Full Version : "Free" textarea


Chrissi
07-15-2003, 05:07 PM
I'd like to know how to make a "free" textarea... that's not a good way of explaining it but it's the only wording I can think of. What I mean is... a box on a web page that any visitor can change... kind of like a guestbook but not really, because anybody can erase anything else that was written and write what they want... of course I'd want a limit on the number of characters allowed. I've wanted one of these ever since I saw it on another person's page (but then forgot where that page was, so I really don't know what it was...)

It should just be a simple textarea box... no usernames, no etc, just a box, just simple.

Does anybody know how to do this? It absolutely HAS to be crossbrowser, from IE to Netscape to Mozilla to Opera, since I use Mozilla and Opera exclusively (but I check my webpages in IE and Netscape just to make sure nothing's goofy).

My webhost allows php, cgi, etc so those aren't a problem if they're needed... just no MySQL or other types of crazy stuff but that shouldn't be a problem should it?

So can anyone help me? Has anyone heard of this before or have an idea of how to do it?

Geekette
07-15-2003, 05:20 PM
Do you mean like a chatter box, where everyone can see what anyone else has typed? The one that I've seen doesn't work with Opera, but I'm sure that there are somethat do.

Chrissi
07-15-2003, 05:25 PM
Kind of like that but it's.... it's just one shared spot and anybody can erase/modify what anybody else has written. Something like what you see when you go to reply to these messages in the reply box... one of those on the site but like, you can change what's in it.. and so can everybody else. (I don't mind swearing or anything so I'm not worried about anonymous profanity). Just like as though when you went to the reply box there was already something in it and you could choose to change it or leave it as it was... and anyone else could change it....

I know it sounds weird and complicated :-p I'm sorry... When I saw it on that website I just absolutely loved the idea and I've been searching for the answer ever since.. it's been like 2 years :-p

Chrissi
07-15-2003, 05:32 PM
Hey! You have my siggy! :D

Geekette
07-15-2003, 05:38 PM
Lol, ThinkGeek rocks the house!

Anyhoo, I do know what you're talking about, I've seen it before too. I'm also having trouble finding it, though. :-/

briankircho
07-15-2003, 06:41 PM
Here is a quick script i made. Make sure you create a file named entry.txt in the same folder and chmod it to writeable:


<?
$message = $_POST['message'];
$file = "entry.txt";
$allowed_length = 100;

if(!empty($message))
{
if(strlen($message) <= $allowed_length)
{
$fd = fopen ($file, "w");
fwrite($fd,$message);
fclose($fd);
}
else
{
$message = "Your Message was longer than the allowed $allowed_length characters";
}

}
else
{
$fd = fopen ($file, "r");
$message = fread($fd, filesize($file));
fclose($fd);
}
?>
<form method="post" action="<? print $PHP_SELF; ?>">
<textarea name="message" cols="30" rows="20"><? print $message; ?></textarea><br>
<input type="submit">
</form>

Chrissi
07-15-2003, 06:49 PM
Thanks so much, that works perfectly!