reece Posted July 6, 2009 Share Posted July 6, 2009 Hey. I am trying to make a frame on my page refresh after a form has been submited, but at the moment it is just ingnoring the script and not refresh the frame. The script is <script type="text/javascript"> window.onload = function() { <?php if(isset($_POST['submit'])) { echo 'parent.mainFrame.document.location.reload();'; } ?> } </script> Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/ Share on other sites More sharing options...
MatthewJ Posted July 6, 2009 Share Posted July 6, 2009 If you view the page source, is "parent.mainFrame.document.location.reload();" showing up? Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869836 Share on other sites More sharing options...
reece Posted July 6, 2009 Author Share Posted July 6, 2009 No it shows <script type="text/javascript"> window.onload = function() { } </script> Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869887 Share on other sites More sharing options...
MatthewJ Posted July 6, 2009 Share Posted July 6, 2009 make sure the submit button has a name of "submit" applied to it. Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869894 Share on other sites More sharing options...
reece Posted July 6, 2009 Author Share Posted July 6, 2009 It actually didn't but, it still dosn't work. Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869919 Share on other sites More sharing options...
MatthewJ Posted July 6, 2009 Share Posted July 6, 2009 $_POST['submit'] would only be set if you click the button, not when you hit enter for instance. Also, you may want to check that the method of the form is post not get. does your code show properly in the source now? Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869957 Share on other sites More sharing options...
reece Posted July 6, 2009 Author Share Posted July 6, 2009 The form uses post and i am clicking the button. Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869960 Share on other sites More sharing options...
MatthewJ Posted July 6, 2009 Share Posted July 6, 2009 Okay, then you might have a logic issue... This code is going to run on page load, which would mean that the submit button would have to be set in php when the page is loaded, it is not going to be set until the button is clicked so your if statement is not going to ever be true. Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869990 Share on other sites More sharing options...
reece Posted July 6, 2009 Author Share Posted July 6, 2009 So is it possible to make a button refresh another frame after submision? Link to comment https://forums.phpfreaks.com/topic/164959-refresh-frame-after-form-submit/#findComment-869993 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.