php-general | 2001062
Date: 06/29/01
- Next message: James Moore: "Re: [PHP] Question on Commercial Offerings"
- Previous message: Aral Balkan: "[PHP] Help with custom session handler"
- In reply to: Richard Kurth: "[PHP] closing window after submit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 6/28/01 3:57 PM, Richard Kurth at rkurth <email protected> wrote:
> I have a form that is in a pop up window it has an image for a submit
> button how can I close the pop up after submitting. I know I can do it
> with javascript with a standard submit button. but how can I do it when
> I use an image for a submit button
>
>
> <form method="post" action="<?echo $PHP_SELF;?>">
> <input type="TEXT" name="email" size="30" maxlength="50">
> <input type="image" src="fm_sub.gif" width="71" height="11" border="0">
>
> Best regards,
> Richard
> mailto:rkurth <email protected>
>
Set a hidden variable within the form, then have PHP check the value when
the page reloads. if the variable is set, have PHP add a JavaScript line to
close the window immediately. !!! Note my syntax may be incorrect.
<html><head><title>Test page<title>
<script language='Javascript'>
<?php
// if we have been here before, my_hidden_var = 1,
// output some JavaScript to close the window.
if ( $HTTP_POST_VARS["my_hidden_var"] == 1 ){print "window.close();"}
?>
</script>
</head>
<body>
<form method="post" action="<?echo $PHP_SELF;?>">
<input type="TEXT" name="email" size="30" maxlength="50">
<input type="image" src="fm_sub.gif" width="71" height="11" border="0">
<!--add a hidden variable to tell PHP we have been here before"--->
<input type="hidden" name="my_hidden_var" value=1>
I believe this will do what you want. If the form has been submitted then
the value of my_hidden_var should cause PHP to insert the correct JavaScript
to close the window.
Is that what you are looking for?
I think a cleaner solution would be to have PHP check the value of the
my_hidden_var and redirect to a thank you page. This could be set to time
out and close if you wanted, or offer a validation step as well.
DAve
-- Dave Goodrich Director of Interface Development Reality Based Learning Company 9521 NE Willows Road, Suite 100 Redmond, WA 98052 Toll Free 1-877-869-6603 ext. 237 Fax (425) 558-5655 daveg <email protected> http://www.rblc.com-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: James Moore: "Re: [PHP] Question on Commercial Offerings"
- Previous message: Aral Balkan: "[PHP] Help with custom session handler"
- In reply to: Richard Kurth: "[PHP] closing window after submit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

