svgmx5 Posted November 6, 2009 Share Posted November 6, 2009 I know this this forum has nothing to do with JS, but i'm trying to use it with my php script. What i'm trying to do, and i'm not 100& sure i'm doing right, is after someone has submitted the form, i want a pop window to appear with text telling them that the for was submitted and what not. I know that i can use open('file.php', 'window_name', 'width = 50, height = 50'); but what i'm not sure is how to use it. i tried using this //if everyting is good, then send the email and reply email $send = mail($to, $subject, $body, $from); $reply = mail($to2, $subject2, $body2, $from2); if($send){ 'open("success.html", "success", "width = 261, height = 200")'; } but when i process the form, it goes but no window opens Like is said i hope i can get help in here in this forum. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/ Share on other sites More sharing options...
jonsjava Posted November 6, 2009 Share Posted November 6, 2009 $send = mail($to, $subject, $body, $from); $reply = mail($to2, $subject2, $body2, $from2); if($send){ print 'open("success.html", "success", "width = 261, height = 200")'; } You need to print the javascript. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952575 Share on other sites More sharing options...
svgmx5 Posted November 6, 2009 Author Share Posted November 6, 2009 thanks for the reply, but thats not working either. all it does, is it actually prints the statement. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952585 Share on other sites More sharing options...
Daniel0 Posted November 6, 2009 Share Posted November 6, 2009 Put it in <script> tags. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952586 Share on other sites More sharing options...
jonsjava Posted November 6, 2009 Share Posted November 6, 2009 try this $send = mail($to, $subject, $body, $from); $reply = mail($to2, $subject2, $body2, $from2); if($send){ print "<BODY onLoad=\"open('success.html', 'success', 'width = 261, height = 200')">"; } Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952587 Share on other sites More sharing options...
mrMarcus Posted November 6, 2009 Share Posted November 6, 2009 wouldn't you need to do something like this: print '<script type="text/javascript">window.open("success.html", "success", "width = 261, height = 200");</script>'; just to ensure compatibility. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952588 Share on other sites More sharing options...
svgmx5 Posted November 6, 2009 Author Share Posted November 6, 2009 no go on any of them.... Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952593 Share on other sites More sharing options...
svgmx5 Posted November 6, 2009 Author Share Posted November 6, 2009 okay i tried it again, and echo '<script type="text/javascript">window.open("success.html", "success", "width = 261, height = 200");</script>'; did work, although it only seemed to work in firefox....IE won't open it, even after i allowed pop ups to be opened...and google nothing shows... can any one think of a better way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952599 Share on other sites More sharing options...
mrMarcus Posted November 6, 2009 Share Posted November 6, 2009 just tested in IE8 and Chrome .. works fine in both. however, you must allow for pop-ups. this is a fundamental error trying to have a pop-up window executed with modern browsers disallowing them by default. consider another method .. perhaps a lightbox (jQuery ThickBox) if you must pop something up. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952603 Share on other sites More sharing options...
Daniel0 Posted November 6, 2009 Share Posted November 6, 2009 Why are you even trying to do this? I absolutely hate when websites try to open new windows for me. I like to decide when and where and if new windows should be opened. I find anything else intrusive. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952606 Share on other sites More sharing options...
svgmx5 Posted November 6, 2009 Author Share Posted November 6, 2009 i tried it too and it did work. And in response to Daniel0 what i only want is a new window to pop up displaying a message saying, hey you submitted the form successfully, if the user successfully submitted the form. Only then should the window open. The script i have right now validates, several fields, and if a user does not input the correct email it will just give an error on the page, and not open a window. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952611 Share on other sites More sharing options...
Daniel0 Posted November 6, 2009 Share Posted November 6, 2009 And in response to Daniel0 what i only want is a new window to pop up displaying a message saying, hey you submitted the form successfully, if the user successfully submitted the form. Only then should the window open. In that case it seems more feasible just printing a message to the screen saying that. Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952614 Share on other sites More sharing options...
svgmx5 Posted November 6, 2009 Author Share Posted November 6, 2009 you are right, that was my first approach to just show the a message after the form was submitted. however, i needed the message to show only and not the form. I had issues with it, and couldn't get it to work. If you can and want you can view the thread that i posted the other day here, i haven't gotten the issue fix that, which is why i tried this method. http://www.phpfreaks.com/forums/index.php/topic,275694.new.html you can read the what my problem was and maybe you can help me with that issue Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952619 Share on other sites More sharing options...
newbtophp Posted November 6, 2009 Share Posted November 6, 2009 If you just want a popup to display upon submit, place this within the if statement (untested): print "<script>alert('Replace with the text you want to show here!');</script>"; Quote Link to comment https://forums.phpfreaks.com/topic/180557-opening-a-window-with-after-form-submission/#findComment-952634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.