Re: [PHP] programming the onclick() event in an anchor

2003-12-25 Thread Evan Nemerson
On Wednesday 24 December 2003 08:06 pm, Peter Walter wrote:
 I have written a session-enabled php page which displays a table of
 search results. The first column in the table contains anchor links to
 www.mydomain.com/mypage?seqno= where seqno is a variable I would
 like to pass when the anchor is clicked. However, I do not wish the
 ?seqno= to display in the url of the browser. After googling a lot,
 it appears that I can use JavaScript to set a session variable in the

I doubt it- otherwise it would be pretty easy to set, say 
$_SESSION['logged_in']

 onclick() event, but I have not been able to find an example of how to

But you /can/ use JS to set a cookie, which can be retrieved (and stored in a 
session variable if you want) by PHP.

http://www.webreference.com/js/column8/
http://us4.php.net/manual/en/reserved.variables.php#reserved.variables.cookies

 do it. Does anyone have experience doing this? Sample code would be
 greatly appreciated.

http://www.webreference.com/js/column8/functions.html


 Peter

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
There is a certain right by which we may deprive a man of life, but none by 
which we may deprive him of death.

-Nietzsche

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



RE: [PHP] programming the onclick() event in an anchor

2003-12-25 Thread Larry Brown
You can place form tags around the anchors and use hidden tags and send
via post so the variable is not obvious.  A user reading the source would
see this though...

echo form name=\form1\ action=\https://this.site.com/somePage.php\;
method=\post\\n;
echo a onClick=\this.form.submit();\SomeLinkText/a\n;
echo input type=\hidden\ name=\variable\ value=\.$value.\\n;
echo /form\n;

I'm not sure off the top of my head if the anchor tag must have any other
description.  You might be able to use onChange instead of onClick to
include selection by using the keyboard, but I'm not sure if the anchor tag
responds to onChange.  You'd have to try it out.

Larry.

-Original Message-
From: Evan Nemerson [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 2:59 AM
To: Peter Walter; [EMAIL PROTECTED]
Subject: Re: [PHP] programming the onclick() event in an anchor


On Wednesday 24 December 2003 08:06 pm, Peter Walter wrote:
 I have written a session-enabled php page which displays a table of
 search results. The first column in the table contains anchor links to
 www.mydomain.com/mypage?seqno= where seqno is a variable I would
 like to pass when the anchor is clicked. However, I do not wish the
 ?seqno= to display in the url of the browser. After googling a lot,
 it appears that I can use JavaScript to set a session variable in the

I doubt it- otherwise it would be pretty easy to set, say
$_SESSION['logged_in']

 onclick() event, but I have not been able to find an example of how to

But you /can/ use JS to set a cookie, which can be retrieved (and stored in
a
session variable if you want) by PHP.

http://www.webreference.com/js/column8/
http://us4.php.net/manual/en/reserved.variables.php#reserved.variables.cooki
es

 do it. Does anyone have experience doing this? Sample code would be
 greatly appreciated.

http://www.webreference.com/js/column8/functions.html


 Peter

--
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
There is a certain right by which we may deprive a man of life, but none by
which we may deprive him of death.

-Nietzsche

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

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



Re: [PHP] programming the onclick() event in an anchor [FIXED]

2003-12-25 Thread Peter Walter
Evan,

Thank you for responding - as a newbie to PHP, HTML, and JavaScript, the 
cookie approach is a little too complex for me. However, after googling 
some more, I came across the following approach which seems to be simple 
and works well:
(a) enclose the result table within a form, specifying the form name as 
results, the post method, and action as the page url to be loaded 
when the anchor is clicked.
(b) insert a hidden field (seqnum) within the form.
(c) In the php code which builds the table, for the anchor link, use the 
following code: ($seqno is the data to be passed)
   print a href=\javascript://\ 
onclick=\document.results.seqnum.value=$seqno;document.results.submit();\;
Result: $HTTP_POST_VARS['seqnum'] will be set to the sequence number.
The only downside to this method seems to be that the visited anchors 
do not change color. Can anyone suggest how to fix that?

Peter

Evan Nemerson wrote:

On Wednesday 24 December 2003 08:06 pm, Peter Walter wrote:
 

I have written a session-enabled php page which displays a table of
search results. The first column in the table contains anchor links to
www.mydomain.com/mypage?seqno= where seqno is a variable I would
like to pass when the anchor is clicked. However, I do not wish the
?seqno= to display in the url of the browser. After googling a lot,
it appears that I can use JavaScript to set a session variable in the
   

I doubt it- otherwise it would be pretty easy to set, say 
$_SESSION['logged_in']

 

onclick() event, but I have not been able to find an example of how to
   

But you /can/ use JS to set a cookie, which can be retrieved (and stored in a 
session variable if you want) by PHP.

http://www.webreference.com/js/column8/
http://us4.php.net/manual/en/reserved.variables.php#reserved.variables.cookies
 

do it. Does anyone have experience doing this? Sample code would be
greatly appreciated.
   

http://www.webreference.com/js/column8/functions.html

 

Peter