RE: [PHP] Javascript var to PHP

2002-12-18 Thread Cesar Aracena
Actually Jon, the IDs are not exactly expressed that way, but your
example gave me a nice idea... To tell you the truth (and now that I
have a clearer idea of what to do), the id I need to pass along is from
a random quote (or FAQ) but I'll fetch it before script is being
declared (even before the HTML tag) and then target the script to a
moreinfo.php?var=varvalue page... (does that make any sense?)

thanks a lot.

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina


-Mensaje original-
De: Jon Haworth [mailto:[EMAIL PROTECTED]] 
Enviado el: miércoles, 18 de diciembre de 2002 8:08
Para: 'Cesar Aracena'; 'Php-General@Lists. Php. Net'
Asunto: RE: [PHP] Javascript var to PHP

Hi Cesar,

> Jon, thanx for the fast response, but the problem is 
> that the link is made dynamically from a DB and the varvalue 
> changes on every link... if it helps, I make this link 
> list with a FOR loop in PHP and the varvalues
> I want to pass are the IDs of a table elements.

You probably need to do it along these lines:

// assume ids are in $id[1...10]
for ($i = 1; $i <= 10; $i++) { 
  echo 'click for more info";
}

and, in your JS function:

function launchinfopage(id)
{
  url = "infopage.php?id=" + id;
  // open url however you like
}

I imagine you have your url hardcoded in your launchinfopage()
function...
this makes it less portable, you may want to consider passing the
complete
url to a generic "open new window" function.

HTH
Jon



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Javascript var to PHP

2002-12-18 Thread Jon Haworth
Hi Cesar,

> Jon, thanx for the fast response, but the problem is 
> that the link is made dynamically from a DB and the varvalue 
> changes on every link... if it helps, I make this link 
> list with a FOR loop in PHP and the varvalues
> I want to pass are the IDs of a table elements.

You probably need to do it along these lines:

// assume ids are in $id[1...10]
for ($i = 1; $i <= 10; $i++) { 
  echo 'click for more info";
}

and, in your JS function:

function launchinfopage(id)
{
  url = "infopage.php?id=" + id;
  // open url however you like
}

I imagine you have your url hardcoded in your launchinfopage() function...
this makes it less portable, you may want to consider passing the complete
url to a generic "open new window" function.

HTH
Jon



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Javascript var to PHP

2002-12-18 Thread Cesar Aracena
Jon, thanx for the fast response, but the problem is that the link is
made dynamically from a DB and the varvalue changes on every link... if
it helps, I make this link list with a FOR loop in PHP and the varvalues
I want to pass are the IDs of a table elements.

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina


-Mensaje original-
De: Jon Haworth [mailto:[EMAIL PROTECTED]] 
Enviado el: miércoles, 18 de diciembre de 2002 7:50
Para: 'Cesar Aracena'; Php-General@Lists. Php. Net
Asunto: RE: [PHP] Javascript var to PHP

Hi Cesar,

> I want one of my links to open a brand-new 
> pre defined window using a javascript 
> but I don't know how to pass a variable so 
> the opened PHP file knows which info to get 
> from MySQL... 

In your launchinfopage() function, presumably you're specifying the url
of
the page ("foo.php" or something)?

If so, just tack the variables on the end of the url as normal:

  foo.php?varname=varvalue

And then, in foo.php, look in the $_GET array:

  echo "varname is ". $_GET['varvalue'];

I do this quite a lot, I can go and dig up the code if you're still
having
problems.

Cheers
Jon


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Javascript var to PHP

2002-12-18 Thread Jon Haworth
Hi Cesar,

> I want one of my links to open a brand-new 
> pre defined window using a javascript 
> but I don't know how to pass a variable so 
> the opened PHP file knows which info to get 
> from MySQL... 

In your launchinfopage() function, presumably you're specifying the url of
the page ("foo.php" or something)?

If so, just tack the variables on the end of the url as normal:

  foo.php?varname=varvalue

And then, in foo.php, look in the $_GET array:

  echo "varname is ". $_GET['varvalue'];

I do this quite a lot, I can go and dig up the code if you're still having
problems.

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Javascript var to PHP

2002-12-18 Thread Cesar Aracena
Hi all,

I want one of my links to open a brand-new pre defined window using a
javascript (defined in the header) with javascript: launchinfopage();
but I don't know how to pass a variable so the opened PHP file knows
which info to get from MySQL... if I use
launchinfopage(varname=varvalue) how can I retrieve that info?

Thanks,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php