popup windows from within a php script

J

Joker7

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
 
J

Joker7

: 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_info->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
 
J

Joker7

:
: > :
: > : <?php
: > :
: > : print '<script type="text/javascript">';
: > : print
'window.open("LINK","NAME","ATTRIBS")\;';
: > : print '</script>';
: > :
: > : ?>
: > :
:: > $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
:
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
 
R

Richard Cornford

Joker7 wrote:
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.

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.
 
J

Joker7

"Richard Cornford" <[email protected]>
wrote in message
<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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,472
Messages
2,571,834
Members
48,802
Latest member
shadowoftheunknown
Top