By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

popup windows from within a php script

P: n/a

Hi,

This is still giving me a big problem !!
Maybe if I post the original code here it may be of more help as the above
will/is not working.
$link = "<a
href=\"newsgroups.php?renew=0&mid=".$message_info->tp_message_id."&sign=".$s
ign."\">";
I wish for the above link to open in a pop-up window,as you may know this
has
been giving me a problem :((

Regards
Chris



Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a

Joker7 wrote:
Hi,

This is still giving me a big problem !!
Maybe if I post the original code here it may be of more help as the above will/is not working.
$link = "<a
href=\"newsgroups.php?renew=0&mid=".$message_info->tp_message_id."&sign=".$s ign."\">";
I wish for the above link to open in a pop-up window,as you may know this has
been giving me a problem :((

Regards
Chris


php runs server side and can therefore not open any browser windows,
cause this must be done client side.

you can, however, have php transmit a javascript to the browser and
have that open the pop up.

code somthing like this:

<?php

print '<script type="text/javascript">';
print 'window.open("LINK","NAME","ATTRIBS")\;';
print '</script>';

?>

micha

Jul 23 '05 #2

P: n/a

<ch*********@web.de> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
: php runs server side and can therefore not open any browser windows,
: cause this must be done client side.
:
: you can, however, have php transmit a javascript to the browser and
: have that open the pop up.
:
: code somthing like this:
:
: <?php
:
: print '<script type="text/javascript">';
: print 'window.open("LINK","NAME","ATTRIBS")\;';
: print '</script>';
:
: ?>
:
: micha
:
I can't see how that would work with

$link =
"<ahref=\"newsgroups.php?renew=0&mid=".$message_in fo->tp_message_id."&sign="
..$sign."\">";
I wish for the above link to open in a pop-up window your code would write
html for a pop-up but,for the life of me I can't see how it helps with my
problem.
Thanks
Chris
Jul 23 '05 #3

P: n/a

Joker7 wrote:
<ch*********@web.de> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
: php runs server side and can therefore not open any browser windows, : cause this must be done client side.
:
: you can, however, have php transmit a javascript to the browser and
: have that open the pop up.
:
: code somthing like this:
:
: <?php
:
: print '<script type="text/javascript">';
: print 'window.open("LINK","NAME","ATTRIBS")\;';
: print '</script>';
:
: ?>
:
: micha
:
I can't see how that would work with

$link =
"<ahref=\"newsgroups.php?renew=0&mid=".$message_in fo->tp_message_id."&sign=" .$sign."\">";
I wish for the above link to open in a pop-up window your code would write html for a pop-up but,for the life of me I can't see how it helps with my problem.
Thanks
Chris

well, i didn't understand your problem then. care to elaborate?

micha

Jul 23 '05 #4

P: n/a

"micha" <ch*********@web.de> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
:
: > :
: > : <?php
: > :
: > : print '<script type="text/javascript">';
: > : print
'window.open("LINK","NAME","ATTRIBS")\;';
: > : print '</script>';
: > :
: > : ?>
: > :
:: > $link =
: >
:
"<ahref=\"newsgroups.php?renew=0&mid=".$messag e_in
fo->tp_message_id."&sign="
: > .$sign."\">";
: >
: >
: > I wish for the above link to open in a pop-up
window your code would
: write
: > html for a pop-up but,for the life of me I
can't see how it helps
: with my
: > problem.
: >
: >
: > Thanks
: > Chris
: well, i didn't understand your problem then.
care to elaborate?
:
: micha
:
Hi Micha,

You are right I'm not explaining my self properly
:(

Using this PHP code that come from a much larger
script :
$link =
"<ahref=\"news.php?renew=0&mid=".$message_info->tp
_message_id."&sign=".$sign."\">";

instead of calling a new page as it is now I wish
to open a frameless window.I will show you what I
have been playing with but just can't get it to
work, it may give you an idea.
$link =
"<ahref='news.php?renew=0&mid=$message_info->tp_me
ssage_id&sign=$sign onClick=\"javascript:
window.open('http://news.php?renew=0&mid=$message_
info->tp_message_id&sign=$
sign','newwindow', 'width=250, height=285,
top=200, left=300, screenX=200, screenY=300,
scrollbars=no, resizable=no'); return false;\"
target=_self>";

Thanks
Chris
Jul 23 '05 #5

P: n/a
Joker7 wrote:
<snip>
You are right I'm not explaining my self properly
:(
No you are not. Posting PHP code to a javascript group will not
encourage people to help you. Javascript (client-side javascript anyway)
is executed on the client and it's source code it the _output_ of your
PHP script. Attempting to debug javascript by looking at the PHP that
generates it is too indirect to be a worthwhile activity. Generally,
debugging dynamically generated javascript source code starts with
looking at the source code that arrives at the browser, to confirm that
the PHP is generating the code expected (complete, well formed and
valid//syntactically correct) and to determine what the client-side code
is actually being asked to do.

Indeed talking about opening a pop-up from a PHP script suggests a
fundamental misconception about the relationship between client-side and
server-side scripting.
Using this PHP code that come from a much larger
script :
$link =
"<ahref=\"news.php?renew=0&mid=".$message_info->tp ^
A space character would be expected in that location.
_message_id."&sign=".$sign."\">";

instead of calling a new page as it is now I wish
to open a frameless window.
How are you defining a "frameless window"?
I will show you what I
have been playing with but just can't get it to
work, it may give you an idea.

$link =
"<ahref='news.php?renew=0&mid=$message_info->tp_me ^
A space character would be expected in that location.
ssage_id&sign=$sign onClick=\"javascript: ^
An apparent opening single quote character before the URL is not matched
by a corresponding closing quote.
window.open('http://news.php?renew=0&mid=$message_
Writing the same URL as is being written into the HREF into the first
argument to the - window.open - call is wasteful as the onclick handler
can refer to whatever URL is specified in the link's HREF with -
this.href - (the same is true of - this.target - in the second argument
for the TARGET attribute, but they do not correspond in this instance).
info->tp_message_id&sign=$
sign','newwindow', 'width=250, height=285,
top=200, left=300, screenX=200, screenY=300, ^ ^ ^
The features list that is the optional third argument to - window.open -
is specified as a comma separated list, not a comma-space separated
list.
scrollbars=no, resizable=no'); return false;\"
target=_self>";


There should be no expectation of this code 'working', and looking at
the output form the PHP should have highlighted at least some of the
reasons for that.

Richard.
Jul 23 '05 #6

P: n/a

"Richard Cornford" <Ri*****@litotes.demon.co.uk>
wrote in message
news:ct*******************@news.demon.co.uk...
<Big Snip>

Every one seem to know I'm doing it wrong but
unable to say how to make it work ,but never
mind - I suspect I will stumble on the answer in
my ignorance's .

Chris
Jul 23 '05 #7

P: n/a
i think i still don't understand your problem, but i'll try anyway.

you have a php script that turns out

$link =
"<ahref=\"news.php?renew=0&mid=".$message_info->tp
_message_id."&sign=".$sign."\">";

this means you have a variable $link that contains a string which is
basically a link in html.

so far so good.

so what do you want to do with that link?? about the only possible
action that comes to my mind is printing it to the browser window, so
your visitors can click it.

in case you want to automatically open the url contained in that link,
you're all wrong.

use only the filename and a location header (works only if no other
output has been sent so far) or aforesaid javascript solution.

micha

Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.