simzam Posted December 24, 2010 Share Posted December 24, 2010 Hi is there any way we can prevent suppose <textarea></textarea> when page reload it refresh and set default text i wanted to know is there any way to prevent certain things not to get refreshed is there any method in php which prevent to reload this ! <?php echo "<textarea > Enter your favorite quote!</textarea> \n" ; if (isset($_GET['edit']) && $_GET['edit'] == 'textupdate'){ } <a href= \"{$_SERVER['PHP_SELF']}?page=1&edit=textupdate \" >Click</a> ?> Quote Link to comment Share on other sites More sharing options...
the182guy Posted December 24, 2010 Share Posted December 24, 2010 So you want to be able to refresh/reload the page but have the textarea retain its value even if the user changes the value then reloads the page? The only way I can think of is to post the contents of the textarea using AJAX regularly, e.g. every 30seconds and save the contents somewhere so that when the page reloads, you can lookup the last saved contents and show it. Quote Link to comment Share on other sites More sharing options...
simzam Posted December 24, 2010 Author Share Posted December 24, 2010 what about session ? Quote Link to comment Share on other sites More sharing options...
simzam Posted December 24, 2010 Author Share Posted December 24, 2010 I'm trying this but its not even working ! textarea should remember previous text value on refresh of page if(isset($_SESSION["quote1"])) $mysession= $_SESSION["quote1"]; else $mysession= ""; echo "Insert Row: <br> <textarea rows=\"1\" cols=\"60\" name=\"quote1\" id= \"textarea12\" wrap=\"physical\" value= \"$mysession\"> \n"; echo "</textarea> \n"; Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 25, 2010 Share Posted December 25, 2010 if(isset($_SESSION["quote1"])) { $mysession= htmlspecialchars($_SESSION["quote1"], ENT_QUOTES); } else { $mysession= ""; } echo "Insert Row: <br> <textarea rows='1' cols='60' name='quote1' id='textarea12' wrap='physical'>$mysession</textarea>\n"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.