473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to re-fill a form with its original data if the user is sent back?

realin
254 100+
hi all,

Well i want to know, if i am typing some data in the textarea of a form and the form returns an error then how do i fill the text area with which user jus submitted the form..

- i tried doing it thru cookie, but cookie actually shows the value, after the page is refreshed once..
-Making session variables is a bad idea..
-Doing it thru hidden field is also not so professional ..
-Now the fourth option left is thru database, but do u think it is wise to have a temporary table to store posts and data like that ? WOnt it overhead the server ?

Please suggest me a method and i will stick to it :)

thanks :)
Sep 28 '07 #1
9 1517
ronverdonk
4,258 Expert 4TB
When your form is submitted via POST and returns, after invalid values, the receiving script can just echo the contents of your textarea, which is in the $_POST array, to the form text-area again. So your code for the textarea looks like:
[php]
<textarea name="kvt" cols="79"><?php echo (isset($_POST['kvt'])) ? $_POST['kvt'] : ""; ?></textarea>
[/php]

If not clear, show your code in this forum and we'll see.

Ronald
Sep 28 '07 #2
realin
254 100+
When your form is submitted via POST and returns, after invalid values, the receiving script can just echo the contents of your textarea, which is in the $_POST array, to the form text-area again. So your code for the textarea looks like:
[php]
<textarea name="kvt" cols="79"><?php echo (isset($_POST['kvt'])) ? $_POST['kvt'] : ""; ?></textarea>
[/php]

If not clear, show your code in this forum and we'll see.

Ronald
holy lord,

i am really dumb at times :D
Sep 28 '07 #3
ronverdonk
4,258 Expert 4TB
holy lord,

i am really dumb at times :D
Happens to all of us sometimes.

Ronald
Sep 29 '07 #4
pbmods
5,821 Expert 4TB
Heya, Realin.

Making session variables is a bad idea..
Can you explain this one? I'm not sure that I understand (let alone agree).
Sep 30 '07 #5
realin
254 100+
Heya, Realin.



Can you explain this one? I'm not sure that I understand (let alone agree).
i mean if i was to do that with session variables then,... i would have been creating a 2-3 sessions variables for every user and that can load my server a bit.. i just thot its not a good practice.. that is why i said so ..

rest u the expert :P
Sep 30 '07 #6
pbmods
5,821 Expert 4TB
Heya, Realin.

i mean if i was to do that with session variables then,... i would have been creating a 2-3 sessions variables for every user and that can load my server a bit.. i just thot its not a good practice.. that is why i said so ..
Adding 2-3 variables to each session file would increase the size of each file by approximately 20-30 bytes.

With 10,000 Users, that would mean that you would be using an extra 200-300 kb.

Given that most (paid) hosting plans start you off with at least 10 GB or so....
Sep 30 '07 #7
realin
254 100+
Heya, Realin.



Adding 2-3 variables to each session file would increase the size of each file by approximately 20-30 bytes.

With 10,000 Users, that would mean that you would be using an extra 200-300 kb.

Given that most (paid) hosting plans start you off with at least 10 GB or so....
So that means saying "sessions variables are bad idea" was right on my part ?
is it ?
Sep 30 '07 #8
pbmods
5,821 Expert 4TB
Heya, Realin.

What I'm saying is that using server-side sessions uses up a negligible amount of disk space.

If you had 10,000 Users, adding the 2-3 session variables would have taken up a mere 300 kb... which represents about .003% (that's three thousandths of a percent) of your total hard disk allocation on a 10 GB server. That's practically nothing.
Sep 30 '07 #9
realin
254 100+
Heya, Realin.

What I'm saying is that using server-side sessions uses up a negligible amount of disk space.

If you had 10,000 Users, adding the 2-3 session variables would have taken up a mere 300 kb... which represents about .003% (that's three thousandths of a percent) of your total hard disk allocation on a 10 GB server. That's practically nothing.
oh thanks.. anyways ..
Sep 30 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would...
4
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
3
by: David Hickman | last post by:
Hi all, This is a newbie question but I have been struggling with this for ages. I have a document with 2 separate <?php sections of code. I would like to declare some variables in the first...
8
by: Lothar Scholz | last post by:
Because PHP5 does not include the mysql extension any more is there a chance that we will see more Providers offering webspace with Firebird or Postgres Databases ? What is your opinion ? I must...
1
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id ...
1
by: Clarice Almeida Hughes | last post by:
tenho um index onde tenho o link pro arq css, como sao visualizados pelo include todas as paginas aderem ao css linkado no index. so q eu preciso de alguns links com outras cores no css, o q devo...
2
by: Frans Schmidt | last post by:
I want to make a new database with several tables, so I did the following: <?php CREATE DATABASE bedrijf; CREATE TABLE werknemers (voornaam varchar(15), achternaam varchar(20), leeftijd...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.