Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to retain the form(html) content data after page refreshed?

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.

like image 479
Kanhu Bhol Avatar asked Nov 13 '22 02:11

Kanhu Bhol


1 Answers

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>
like image 108
casraf Avatar answered Nov 14 '22 21:11

casraf