I just had one doubt:
I have a form where I do server side validation.. i have np with validation, BUT the prob is:
In a Form, assume I entered some 9 fields (instead of 10 ), it shows me an erros saying that ’10th field missing’ and all the data I entered in 9 fields has to be re-entered again.. (sometimes its really damn tough to re-enter same data because of small mistake )
so, aim thinking that whatever the data entered previously in textfield or textarea or some other html element, it should be saved automatically even after server validation does.. so that user need not re-type again..
how can I achive this.. I tried in google, but didnt understood how to search for this kind of sittuation and i did not find any solution yet..
sory for my bad english.. Hope u udnerstood my prob..
so, any suggestions..?
@Jim, this is the same situation as in your original question.
(Before anybody points out that it is a different account, it’s the same actual person – long story!)
PHP will not keep the “state” of the control when you send it back to the browser after a post-back.
So instead of sending back the following each and every time…
You need to send back what was originally entered as part of the control…
With checkboxes and radios (which was your original question), you need something like…
And as you’re talking about
<textarea>controls, you’d do something like…Update
As you are building the HTML into the
$echostring variable (rather than just having the HTML mark up directly), you need to include the above code as part of the string.If you do an
echocommand during the building of the string, the thing beingechoed will be sent to the screen straight away. Then when you send the contents of$echovia the commandecho $echo;you get everything else.So, for a single line textbox you would do…
For a checkbox you would do…
For a multi line textbox you would do….
So you see that we are including the existing value of the control as part of the string that you are building.