Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Text-area with 'memory'
Old 11-21-2010, 01:04 PM Text-area with 'memory'
Junior Talker

Posts: 4
Trades: 0
I have simple website (thanks to htaacess only two people have an access there)


HTML Code:
<html> 
<head> 
</head> 
<body> 
<textarea name="spis" cols="40" rows="40"></textarea> 
</body> 
</html>
And I want that when user types sth in this text-area it is remembered. After some days when he cames (or another user) it can read, change it and save again.

Is it possible? If yes, how?

Last edited by chrishirst; 11-21-2010 at 05:15 PM..
win_pytacz is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-21-2010, 03:08 PM Re: Text-area with 'memory'
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Yes, it's possible.
What you need to do, is set up a javascript event listener that will send the content of the textarea to a db (or in a cookie, if there is only 1).

For that, you will need to identify the user though.
Either via a cookie (weak, can be altered or dropped easily) or via a login form.
Then, each time the focus is lost on the textarea, use a xmlHttpRequest (ajax) object to send to the db which text-area it is, it's content, and the id of the user.

Next time he comes back to that page, simply check the db for existing content and pre-fill the textarea.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 11-21-2010, 03:17 PM Re: Text-area with 'memory'
Junior Talker

Posts: 4
Trades: 0
wow quite complicated. Is it a simplier way using for example txt file?

if yes will it code be complicated ? (anything besides html?)
win_pytacz is offline
Reply With Quote
View Public Profile
 
Old 11-21-2010, 04:04 PM Re: Text-area with 'memory'
wayfarer07's Avatar
Poo on You

Latest Blog Post:
jQuery Mapbox Updated
Posts: 4,041
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Tripy's way is pretty elegant, though not as complicated as you think, but if you just wanted to have a single textarea that is part of a form, and displays the same content to everyone, saving its value to a file, that would be pretty simple.

You want it to show the same thing to everyone, or different things to different users? A community notepad or a personal notepad?
__________________
Software engineer at
Please login or register to view this content. Registration is FREE
.

Last edited by wayfarer07; 11-21-2010 at 04:05 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 11-21-2010, 04:36 PM Re: Text-area with 'memory'
Junior Talker

Posts: 4
Trades: 0
It would be the same to all users (it will be 2 users). It is only for communicate these two people who have access to this site
win_pytacz is offline
Reply With Quote
View Public Profile
 
Old 11-21-2010, 05:02 PM Re: Text-area with 'memory'
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Then it's even simplier.
Just save the textarea content on each unfocus, and replace the database value with it.

But what will happen if the 2 are there together?
I have to say, that maybe you should envisage another solution.
Maybe something like http://ajaxim.com/
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 11-21-2010, 05:23 PM Re: Text-area with 'memory'
chrishirst's Avatar
Defies a Status

Posts: 44,044
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by win_pytacz View Post
(anything besides html?)
It cannot be done with HTML at all
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-22-2010, 03:39 AM Re: Text-area with 'memory'
Banned

Posts: 405
Name: mushget
Trades: 0
Quote:
Originally Posted by chrishirst View Post
It cannot be done with HTML at all
You can use php code. remember the input data into database.
mushget is offline
Reply With Quote
View Public Profile Visit mushget's homepage!
 
Old 11-22-2010, 04:58 AM Re: Text-area with 'memory'
Mime's Avatar
Extreme Talker

Posts: 164
Name: Seb
Trades: 0
If you have PHP the following code works. You don't need a database because it uses a .txt file. You need to press a button to save it.

PHP Code:
<?php
if ( isset ($_POST ['message']) )
{
    
file_put_contents ('message.txt'$_POST ['message'] );
}
?>
<html>
<head>
<title>Save Message</title>
</head>
<body>
<form method="post">
<textarea name="message" cols="40" rows="20">
<?php
include 'message.txt';
?>
</textarea>
<br />
<input type="submit" value="Save">
</form>
</body>
</html>
I couldn't be bothered writing !DOCTYPEs or anything, just so you know.
Mime is offline
Reply With Quote
View Public Profile
 
Old 11-22-2010, 08:35 AM Re: Text-area with 'memory'
wayfarer07's Avatar
Poo on You

Latest Blog Post:
jQuery Mapbox Updated
Posts: 4,041
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
A simple solution like Mime's is more like what I was thinking of. The AJAX idea Tripy posted is pretty cool, but I suspect this is a complexity you're not ready to deal with.
__________________
Software engineer at
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Text-area with 'memory'
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26075 seconds with 11 queries