PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have an iframe and I perform functions within it. An example is when a user modifies a transaction (within the iframe) it loads a seperate script to perform the modification, then after doing so, uses something like this to reload the iframe back to its original state:
So when the original script is reloaded with the header command I then call that script to reload the whole page?
That's kind of double reloading.
I'll do it if there's no other way, but is there a more elegant way to reload the whole parent page without having to head back to relod the iframe first?
header() is PHP & that is JS. both have differences you know and I was thinking of refreshing the whole page since its needed but won't the iframe also refresh when the whole page is refreshed and the located will be reverted automatically. I don't see the need for a header().
the iframe does refresh when the WHOLE page refreshes, except when i use header to reload the previous file that the new iframe file came from, it does not reload the rest of the page.
Perhaps this diagramme will help:
I guess what i need, is rather than the iframe reloading just the iframe, i want it to go back and refresh the main document (the parent) which will do the same thing and have the added bonus of refreshing everything in the main document (my primary objective with this problem).
I hope that's clearer, and I suspect I may be missing something you're saying.... maybe the implimentation of that script...?
robster wrote:i want it to go back and refresh the main document (the parent) which will do the same thing and have the added bonus of refreshing everything in the main document (my primary objective with this problem).
Back window.history.go(-1);
Refresh document.location.reload();
omg! so easy! I feel a bit of a twat. I guess then, the next question (I'm a complete neub at javascript) is... How can I actually trigger that javascript?
I know how to do onclicks, and onmouse events ect, but how can i do it inline?
<?
$clientid = $_GET['clientid']; //get the client id from the post data
$letter = $_GET['letter']; //get the letter from the post data
$id = $_GET['id']; //get the letter from the post data
$price = $_GET['price']; //get the letter from the post data
include "config.php";
include "functions_salon.php";
$Update = mysql_db_query ($dbname, "UPDATE transactions_tmp SET price = $price WHERE id = '$id'") or die('Could not edit price: ' . mysql_error());
header("Location: pos_iframe_contents.php?clientid=$clientid&letter=$letter");
?>
So I'm still kind of stuck. I like the idea of using the history.go(-1) to go back to the previous file, then using the document.location.reload to refresh it,but as I say, it just infinite loop reloads
I've not heard of a echo <<<JS before?!
I even just searched google, and nothing! Is it some secret underground php/javascript thing? LOL!
Really, thank you so much, it's working a treat! I would have though that telling script to go back in history would then stop execution of the js. That's pretty special that it keeps on executing, even when the browser has been sent back in history.
This operator (i have forgot its exact name ) tells PHP to output everything until the token after it (here, JS) is found. It comes very handy sometimes