I am working on a site in which the user (after logging in) is sent to the home page of the site (home.php). On this home page are 4 separate iframes, each within a separate div and each populated by a different php file (not home.php). The site is not finished but I am trying to build the site with bandwidth minimization in mind. In one of the containers is an iframe which is populated by users.php as follows:
<div id="SomeDiv">
<iframe name="frame3" width="1050" height="175" src="users.php" frameborder="0" ></iframe>
</div>
What I have currently done is put a status-setting button within users.php itself, which when pressed changes the user's 'status'....works great. After pressing the button, the location is re-set to users.php as follows:
if (($_POST['hidden']) == 'On') {
$login_id=mysql_real_escape_string($_SESSION['login_id']);
$Update1=mysql_query("UPDATE login SET Status = 'On' WHERE
login_id = '$login_id'");
$message = 'You have set your status to: ON';
echo "<SCRIPT>
alert ('$message');
location='users.php';
</SCRIPT>";
}
else if (($_POST['hidden']) == 'Off') {
$login_id=mysql_real_escape_string($_SESSION['login_id']);
$Update2=mysql_query("UPDATE login SET status = 'off' WHERE
login_id = '$login_id'");
$message1 = 'You have set your status to: OFF';
echo "<SCRIPT>
alert ('$message1');
location='users.php';
</SCRIPT>";
}
I have intentionally coded this way instead of putting the button within 'home.php' and setting location='home.php' after the button is clicked; my reasoning was this was a quick and easy way to save on bandwidth (i.e., only the iframe reloads by setting the location = 'users.php', instead of the whole page reloading by setting location = 'home.php' by placing the button within the code of 'home.php'). As a beginner, this seems like a great bandwidth-reducing strategy, plus it's much faster (about half a second) than a whole page reload (about 1.5 seconds). As a beginner, are there any potential pitfalls of this method of which I am unaware?