RE: [PHP] How pass form variable to window.open()
| From: | Jason Davidson | Date: | Thu, 05 Aug 2004 15:28:42 +0000 |
| Subject: | RE: [PHP] How pass form variable to window.open() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192880@lists.php.net to get a copy of this message | ||
Unless student is set somewhere else that wont work.. you need the form
to submit before the text field 'student' sets a var named student.
One way to do such, without all the window formating is to just submit
the form to the page you want. and target=_new in the form tag.
other than that, you must use javascript to grab the data from the
textfield, then use window.open() ..create a javascript method called
openwin or something that gets called OnClick on your button.
function openWin() {
student = document.Form.Student.value;
win = open('yourpage.html?student=' + student, 'Title',
'width=45,height=34');
win.focus();
}
"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote:
>
> [snip]
> Anyone can tell if, inside php script, I can pass form variable to the
> javascript window.open() call?
>
> That is,
>
> in the form, for example, i have <input type=text.. name=student ...>
>
> and <input type=button onClick=window.open('url?student=$student', ....)
>
> It seems to me not working.
> [/snip]
>
> You have to echo or print the sJavaScript statement with PHP,
>
> print("<input type=\"button\"
> onClick=\"window.open('url?student=$student', ....)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>