Jump to content

prevent something from reload


simzam

Recommended Posts

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>

?>

Link to comment
https://forums.phpfreaks.com/topic/222586-prevent-something-from-reload/
Share on other sites

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.

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";

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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.