View Full Version : saving value of a text field

Jun 29th, 2007, 04:46 AM

First off - i know its not really a good practice to have a question as your first post, i browsed through the forum trying to answer at least one question for someone, but javascript isnt my strong point and i couldnt contribute just yet. However if someone is kind enough to help me out with this problem ive been having, ill be very grateful.

Problem is quite simple i think: I have a small page, which contains the following form:

<form method="post" action="shoutbox.php?action=new" name="form1">
<table width="100%">
<td width="8%">Name</td>
<td width="92%">
<input tabindex=1 type="text" name="name" class="namebox-txt" /><input tabindex=3 type="submit" name="Submit" value="Submit" class="shoutbox-btn" />
<td><input tabindex=2 name="message" type="text" class="shoutbox-txt" maxlength="100"/></td>

the purpose of this form is to collect a user name, and user's message, and then it passes it into a .txt file which acts as a "database" for a small chatbox.

Everything works fine, apart from one inconvenient detail - every time the form page gets refreshed (which happens after they push submit), the name dissapears, and users have to keep retyping their name. I tried mucking around with creating a cookie and calling the name from there, but i couldnt get my head around it. Apparently there is a way of storing a value temporarily even without using cookies?

Any help would be appreciated.


Jun 29th, 2007, 05:40 AM
These two pages from the MSDN site show an alternative
I'm not sure how cross-compatible it is though

Since you are using php, it my be better to handle this server side.

Jun 29th, 2007, 06:12 AM
Oh wicked thanx mate. Ill get onto that now and will post if it works. Looks like it should though.

Jun 29th, 2007, 06:18 AM
FWIW I think you call that a "flat file" database