PHP doesn't "remember" the user input. What to do?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
You got it right, and what you proposed hits very near. Great!
Language select is in a similar bit of code a bit closer to the top of the page.
I haven't posted it here. If I solve that bit of code just below, all the rest will be solved, I hope.
Now the script, of course, selects the last value "12.8" because it is the last "selected" in the row. If I select "12.6", after the form is executed, 12.8 is shown in the drop down. It is very intriguing now, because I feel a solution isn't far.
Nephilim! You got it absolutely right, and the problem is solved! Actually I tried to do what you proposed. It did not work because apparently I typed in something wrong without seeing it. Thanks a lot!
Just one more question, if I may. How do you make the script "remember" the user input, if no value is hardcoded? Example:
<input type="text" name="stringlength" size="4" maxlength="5" value="">
I'd be glad to do it without registering a session if that's possible (I am not good at sessions yet).
Once the value entered by the user it is displayed in the form results below.
I'd like the script to pick that value up, and redisplay in the form.
You see, I tried it and that doesn't work. The script doesn't reintroduce the $stringlenght into the form, because the $stringlenght is displayed in a HTML output just below the <form>.
<? echo $stringlength; ?> is correct.
I'll try to make it clearer. User-entered value is displayed in a bit of HTML just below the </form>. This value is not redisplayed in the line above, that is in the <form>.
If it was possible to change the order of lines in the code, placing HTML output before the <form>, it would work, but that's not the case.
So, <input name="stringlength" value"<? echo $stringlength; ?>">
goes before HTML output which looks like this:
<p><? print $lang_subtitle $stringlength; ?> <br>
Once the form is executed, the script can not fetch the $stringlength from HTML, and redisplay it in the form above. I am sure it is possible, but I don't know how. I tried to do it with session, but it's a complicated matter. After all, you taught me how to redisplay the choosen values in a simple manner without sessions. Thanks for all.