Jump to content

opening a window with after form submission


svgmx5

Recommended Posts

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.

 

   $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.

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')">";

        }

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?

 

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.

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.

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.

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

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.