Well, here is an example of what you could use:
$q = new CGI;
if(defined($q->param("confirm"))) {
if($q->param("confirm") eq "yes"){
#execute code for yes
}
else {
#execute code for no
}
}
else {
print $q->header(),
"<html>\n",
"<head>\n",
"<script laguage\"JavaScript\">\n",
"<!--\",
"popup=window.open(\"\", \"Confirm\",\"width=350, height=400,
+ toolbar=no menubar=no, scrollbars=no, resizeable=no\")\n",
"popup.location.href=\"http://domain.com/confirm.html\n\",
"popup.opener.name = \"opener\",
"// -->\n",
"</script>\n",
"</head>\n<body>",
"</body></html>";
}
Then your confirm.html page could look like this
<html>
<body>
<form target="opener" action"location.of.script" method="post" o
+nsubmit="window.close()">
<input type="radio" value="yes" name="confirm">Yes
<input type="radio" value="no" name="confirm">No
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>
Update: I'm not sure and I didn't feel like testing it right now but the onsubmit tage in the form might be slightly miss written. What might happen, unfortunately is that the window would close before the form got submitted. So instead of testing the code, I will offer an alt. so as to make my life easier. First delete the onsubmit attribute. Then put this code replace the perl ouput code to this:
...
else {
print $q->header(),
"<html>\n",
"<head>\n",
"<script laguage\"JavaScript\">\n",
"<!--\",
"popup=window.open(\"\", \"Confirm\",\"width=350, height=400,
+ toolbar=no menubar=no, scrollbars=no, resizeable=no\")\n",
"popup.location.href=\"http://domain.com/confirm.html\n\",
"popup.opener.name = \"opener\",
"// -->\n",
"</script>\n",
"</head>\n<body onunload=\"popup.close();\">",
"</body></html>";
}
...
P.S. this might just be a better all around solution.
Clovs aka
jclovs
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.