The following code succesfully refreshes the #content div, but in doing so it clear the $name variable which is passed from a previous page. How can I reload the div without losing my variable? The following is the code in "thispage.php". Any help would be appreciated!


setInterval(function() {
    $('#content').load('thispage.php #content');
}, 3000);




include 'php/db.php';

$name = $_POST['name'];

echo '<div id="content">';

$ad= mysql_one_data("SELECT ad FROM tab1 WHERE name = '$name'");

echo 'Address ' .$ad. ' <br>';

echo '</div>';



You could store the POSTed value in a session variable, just be sure you do not overwrite it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.