window.open in a php script

J

Joker7

Hi-I'm stuck again can anyone help me out here.
I'm trying to open a frame less window (popup) from within a PHP script
this is what it looks like before I had a play :((

$link = "<a
href=\"news.php?renew=0&mid=".$message_info->tp_message_id."&sign=".$sign."\
">";

My try:(

$link = '<a href="news.php?renew=0&mid="'.$message_info-onClick="javascript:
window.open('http://"news.php?renew=0&mid="'.$message_info-','rad','width=25
0,height=285,top=200,left=300,screenX=200,screenY=300,scrollbars=no,resizabl
e=no');return false;" target="_self">tp_message_id.'&sign='.$sign.'>';

With my try the whole thing goes to pot.

Parse error: parse error, unexpected '=' in
/home/site/public_html/news/web/show_header.php on line 450

Regards
Chris
 
L

Lee

Joker7 said:
Hi-I'm stuck again can anyone help me out here.
I'm trying to open a frame less window (popup) from within a PHP script
this is what it looks like before I had a play :((

$link = "<a
href=\"news.php?renew=0&mid=".$message_info->tp_message_id."&sign=".$sign."\
">";

My try:(

$link = '<a href="news.php?renew=0&mid="'.$message_info-onClick="javascript:
window.open('http://"news.php?renew=0&mid="'.$message_info-','rad','width=25
0,height=285,top=200,left=300,screenX=200,screenY=300,scrollbars=no,resizabl
e=no');return false;" target="_self">tp_message_id.'&sign='.$sign.'>';

With my try the whole thing goes to pot.

Parse error: parse error, unexpected '=' in
/home/site/public_html/news/web/show_header.php on line 450

When you cause PHP errors by modifying PHP code that you
don't understand, you should ask for help in a PHP group.
 
J

Joker7

: header.php on line 450
:
: When you cause PHP errors by modifying PHP code that you
: don't understand, you should ask for help in a PHP group.
:

I have and PHP groups say go and ask in Javascript groups :(( as it's a
Javascript problem.

Chris
 
M

Mick White

Joker7 wrote:

I have and PHP groups say go and ask in Javascript groups :(( as it's a
Javascript problem.

Chris

Definitely a PHP problem, the javascript is never called.
Mick
 
L

Lee

Joker7 said:
: header.php on line 450
:
: When you cause PHP errors by modifying PHP code that you
: don't understand, you should ask for help in a PHP group.
:

I have and PHP groups say go and ask in Javascript groups :(( as it's a
Javascript problem.

They're just trying to blow you off.

Here's the line before you mangled it. I've separated it into separate lines at
the concatination operators "."

$link = "<a href=\"news.php?renew=0&mid=" .
$message_info->tp_message_id .
"&sign=" .
$sign .
"\">";

Every thing there from the opening \" (on the first line) to the closing
\" (on the last line) is what's being assigned to the HREF attribute.

When you edited it, you dropped code beginning with "onClick" right smack
in the middle of the second operand. That's a PHP error.

the beginning of the line you wound up with is:

$link = '<a href="news.php?renew=0&mid="' .
$message_info-onClick="javascript:window.open('http://"

I'm guessing that you thought that the ">" marked the end of the
<a> tag, but in this context, it was actually part of the "->" operator.
So, in addition to breaking the "$message_info->tp_message_id" identifier,
you've added a second "=" to an assignment statement. That's what the PHP
compiler was complaining about.

These are all PHP errors.
 
H

Hywel Jenkins

Hi-I'm stuck again can anyone help me out here.
I'm trying to open a frame less window (popup) from within a PHP script
this is what it looks like before I had a play :((

$link = "<a
href=\"news.php?renew=0&mid=".$message_info->tp_message_id."&sign=".$sign."\
">";

My try:(

$link = '<a href="news.php?renew=0&mid="'.$message_info-onClick="javascript:
window.open('http://"news.php?renew=0&mid="'.$message_info-','rad','width=25
0,height=285,top=200,left=300,screenX=200,screenY=300,scrollbars=no,resizabl
e=no');return false;" target="_self">tp_message_id.'&sign='.$sign.'>';

With my try the whole thing goes to pot.

That's because you're mucking around with the apostrophes. You start
your string with ', then you have them in your window.open function,
then you have them dotted through the code. Use \'.
 

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
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top