Reputation: 470
Please give me a good suggestion but without using Ajax. I mean to say is it possible to do in JavaScript/J query or else.
My Issue : When i am submitting one page, the action class again return to this same page now as per my requirement i have to retain the state of some radio button and checked boxes checked as it checked before.
Any help will be appreciated.
Upvotes: 6
Views: 1436
Reputation: 21694
If the form action redirects to the same page, i.e. you want to repopulate the same field that was just sent on the same page, you can just enter the form data as default value:
<form action="form.php" method="post">
<input type="text" name="name" placeholder="Enter your name" value="<?=$_POST['name']?>" />
</form>
Upvotes: 1
Reputation: 46785
You need to save the form data (state of the form) in a session, which will involve setting cookies or local storage, some of which may be implemented using JavaScript.
If I were doing it, I would store the values from my form in session variables and then repopulate the form when I return to the page.
This can be done using a server side scripting language such as PHP or JSP or .net
An example of how to get started with JSP, I suggest the following tutorial:
http://www.jsptut.com/sessions.jsp
Upvotes: 0