[PHP] how to pass value from popup window to php program
Hi all, I met one problem as below. To express clearly i use some psu-code instead: //this is php code if ($need_user_email_address) { //we popup a window to let user fill his/her email popup_window($give_me_your_email); //we get the user email from the popup window echo your email is $give_me_your_email \n; } I do not know whether it can be implemented or not, if 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. Thanks in advance! zhunbao __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
On Wednesday, February 6, 2002, at 10:52 AM, Zhunbao Zhi wrote: I do not know whether it can be implemented or not, if 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. One way to do it is to store the $email_name as a session variable. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to pass value from popup window to php program
Hi all, I am a new comer for PHP. now my situation like below, to express clearly i used some expression instead of PHP code in below php code: if ($need_to_know_your_email) { //popup one window to get the user' email JavaScript:window.open(leave your email address); //then i try to get the $emailaddress from the //popup window , for example as $emailaddress echo your email is $emailaddress\n; } I just do not know whether above code can be implemented or not, if so, how can i get the email address from the popup window? Thanks, zhunbao __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
Storing variables on the client-side using JavaScript can be done by setting a cookie. The cookie data will ofcourse be available to PHP when the next script is executed (for example through a link or redirect). bvr. On Wed, 6 Feb 2002 11:13:01 -0500, Erik Price wrote: Sounds like if you don't want to do a lot of form-submitting, you'll have to use JavaScript to store/display the variable dynamically on the client side. I don't know how to grab JavaScript variables and use them as PHP variables, perhaps someone else on the list can help here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
On Wednesday, February 6, 2002, at 12:26 PM, bvr wrote: Storing variables on the client-side using JavaScript can be done by setting a cookie. The cookie data will ofcourse be available to PHP when the next script is executed (for example through a link or redirect). Ahh... is this the standard procedure for passing variables form JS to PHP? Is there a way that will work on browsers with cookies disabled? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
There is no way of passing a variable from JS to PHP without sending something back to the server or using a cookie. I haven't followed the thread at all, but if I needed to pass a value from a pop-up window to a PHP program, I'd probably do something like this: In the pop-up window, once the form's submit button is clicked or a Click here link is clicked, the page calls the PHP program. The PHP program processes the variable (sticking the value in the database, whatever), then outputs a bit of HTML/JS just to close the window. Note that absolutely NOTHING will happen if the user closes the window by clicking the close widget on the window itself. On Wed, 2002-02-06 at 09:36, Erik Price wrote: On Wednesday, February 6, 2002, at 12:26 PM, bvr wrote: Storing variables on the client-side using JavaScript can be done by setting a cookie. The cookie data will ofcourse be available to PHP when the next script is executed (for example through a link or redirect). Ahh... is this the standard procedure for passing variables form JS to PHP? Is there a way that will work on browsers with cookies disabled? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php