p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: javascript inside PHP


Message #1 by boesh@b... on Sun, 10 Feb 2002 20:40:53
Where and why is de code below not correct, and what should the corerct 

code be:



print("Uw voorkeursrollen zijn: <a href=\"javascript:openWindow

($voorkeurrol[1],300,200,'no')\"> $voorkeurrol[1] </a> en <a 

href=\"$voorkeurrol[2]\">$voorkeurrol[2]</a>");



There are some Dutch words in it.. the message I get is: 



"Error: 'Specialist' is not defined. 





In this particular case $voorkeurrol[1] has the value Specialist,

but what does it mean that Specialist is not defined, where shpould I have 

taken care of the defining of Specialist?

Message #2 by "Hermawan Haryanto" <hermawan@h...> on Mon, 11 Feb 2002 04:10:32 +0700
Try this way :



print("Uw voorkeursrollen zijn: <a href=\"javascript:openWindow>

('$voorkeurrol[1]',300,200,'no')\"> $voorkeurrol[1] </a> en <a

href=\"$voorkeurrol[2]\">$voorkeurrol[2]</a>");



I guess that the variable $voorkeurrol[1] it supposed to be string, so it

has to have ' '

And I think that $voorkeurrol[1] must be a html page address, but I don't

know your openWindow function on your javascript.



Thanks

Hermawan Haryanto

hermawan@h...







----- Original Message -----

From: <boesh@b...>

To: "beginning php" <beginning_php@p...>

Sent: Sunday, February 10, 2002 8:40 PM

Subject: [beginning_php] javascript inside PHP





> Where and why is de code below not correct, and what should the corerct

> code be:

>

> print("Uw voorkeursrollen zijn: <a href=\"javascript:openWindow

> ($voorkeurrol[1],300,200,'no')\"> $voorkeurrol[1] </a> en <a

> href=\"$voorkeurrol[2]\">$voorkeurrol[2]</a>");

>

> There are some Dutch words in it.. the message I get is:

>

> "Error: 'Specialist' is not defined.

>

>

> In this particular case $voorkeurrol[1] has the value Specialist,

> but what does it mean that Specialist is not defined, where shpould I have

> taken care of the defining of Specialist?

>




$subst('Email.Unsub').

>



Message #3 by "Krister" <krister@m...> on Mon, 11 Feb 2002 01:12:38 +0100
Hi



I suppose that your error is in the javascript. This one would work:



<html>

<head>

<script language='javascript'>

function win() {

wind = window.open("<?php print ( $pecialist[0] );

?>.htm","wind","status=no, toolbar=no, location=no, menu=no, width=200,

height=200"); }

</script>

</head>

<body>

<?php

print ("Uw voorkeursrollen zijn: <a

href=\"javascript:win()\">$pecialist[0]</a> ");

print ("en ");

print ("<a href=\"$pecialist[1]\">$pecialist[1]</a>");

?>

</body>

</html>



Krister :-)



----- Original Message -----

From: <boesh@b...>

To: "beginning php" <beginning_php@p...>

Sent: Sunday, February 10, 2002 8:40 PM

Subject: [beginning_php] javascript inside PHP





> Where and why is de code below not correct, and what should the corerct

> code be:

>

> print("Uw voorkeursrollen zijn: <a href=\"javascript:openWindow

> ($voorkeurrol[1],300,200,'no')\"> $voorkeurrol[1] </a> en <a

> href=\"$voorkeurrol[2]\">$voorkeurrol[2]</a>");

>

> There are some Dutch words in it.. the message I get is:

>

> "Error: 'Specialist' is not defined.

>

>

> In this particular case $voorkeurrol[1] has the value Specialist,

> but what does it mean that Specialist is not defined, where shpould I have

> taken care of the defining of Specialist?

>




$subst('Email.Unsub').

>



Message #4 by boesh@b... on Tue, 12 Feb 2002 18:52:04
THE SOLUTION:



<a href=\"javascript:openWindow('$voorkeurrol[3].htm',300,200,'no')\"> 

$voorkeurrol[3]</a>



And there was nothing wrong with my javascript ;-)













> Hi

> 

> I suppose that your error is in the javascript. This one would work:

> 

> <html>

> <head>

> <script language='javascript'>

> function win() {

> wind = window.open("<?php print ( $pecialist[0] );

> ?>.htm","wind","status=no, toolbar=no, location=no, menu=no, width=200,

> height=200"); }

> </script>

> </head>

> <body>

> <?php

> print ("Uw voorkeursrollen zijn: <a

> href=\"javascript:win()\">$pecialist[0]</a> ");

> print ("en ");

> print ("<a href=\"$pecialist[1]\">$pecialist[1]</a>");

> ?>

> </body>

> </html>

> 

> Krister :-)

> 

> ----- Original Message -----

> From: <boesh@b...>

> To: "beginning php" <beginning_php@p...>

> Sent: Sunday, February 10, 2002 8:40 PM

> Subject: [beginning_php] javascript inside PHP

> 

> 

> > Where and why is de code below not correct, and what should the corerct

> > code be:

> >

> > print("Uw voorkeursrollen zijn: <a href=\"javascript:openWindow

> > ($voorkeurrol[1],300,200,'no')\"> $voorkeurrol[1] </a> en <a

> > href=\"$voorkeurrol[2]\">$voorkeurrol[2]</a>");

> >

> > There are some Dutch words in it.. the message I get is:

> >

> > "Error: 'Specialist' is not defined.

> >

> >

> > In this particular case $voorkeurrol[1] has the value Specialist,

> > but what does it mean that Specialist is not defined, where shpould I 

have

> > taken care of the defining of Specialist?

> >




> $subst('Email.Unsub').

> >

> 


  Return to Index