Re: how to pass value from popup window to php program
| From: | bvr | Date: | Wed, 06 Feb 2002 17:22:17 +0000 |
| Subject: | Re: how to pass value from popup window to php program | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83726@lists.php.net to get a copy of this message | ||
For info on JavaScript functions, like window.open() use google to find resources.
For passing back values to PHP you need a script that does 2 things:
- Ask for the email address
- Handle the address with PHP
Because PHP will not wait for a user to put in it's e-mail address,
these are two separate pieces of code.
You can do this for example by checking if the email address has
been entered:
<?php // myscript.phtml
if ($email)
{
// Part 1
} else
{
// Part 2
}
?>
Part 1 handles the email address the way you want
Part 2 can be done in a number of ways, as long as the e-mail address
gets entered and send back to the script.
A simple way is using a form:
<FORM ACTION="myscript.phtml">
<INPUT TYPE=TEXT NAME="email">
</FORM>
But you could also use JavaScript to create a dialog
and 'redirect' to your script, passing the email address
in the URL, probably something like:
email = prompt("Please enter your address");
document.window.location.href = "myscript.phtml?email=" + escape(email);
bvr.
On Wed, 6 Feb 2002 07:52:46 -0800 (PST), Zhunbao Zhi wrote:
>it can be done, i really do not know how to produce
>the popup window and how to pass value from the popup
>window to the php main code.