[PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

Hi,

i need to pass a variable by letting the user click on a link. Right now i
do it like: page.php?variable=value

However, i don´t want the variable, and it´s value to appear in the adress
bar of the browser. And i don´t want people to be able to pass the same
variable by reloading the destination page.

Any pointers on how i can do this?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 705 38 10 30 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




Re: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Tyler Longren

You could use a form and have a hidden vield that contains a value.  The
user would have to click the submit button for the variable/value to carry
over though.

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

- Original Message -
From: Daniel Alsén [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 9:02 AM
Subject: [PHP] Passing a variable invisibly via a href?


 Hi,

 i need to pass a variable by letting the user click on a link. Right now i
 do it like: page.php?variable=value

 However, i don´t want the variable, and it´s value to appear in the adress
 bar of the browser. And i don´t want people to be able to pass the same
 variable by reloading the destination page.

 Any pointers on how i can do this?

 Regards
 # Daniel Alsén| www.mindbash.com #
 # [EMAIL PROTECTED]  | +46 705 38 10 30 #
 # ICQ: 63006462   | +46 8 694 82 22  #
 # PGP: http://www.mindbash.com/pgp/  #


 --
 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: Re: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Adam Voigt

You could actually have javascript auto-submit the form if you didn't want the button
like:

script language=javascript
document.form1.submit();
/script

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2 Apr 2002 09:08:18 -0600, Tyler Longren [EMAIL PROTECTED]  wrote:
 You could use a form and have a hidden vield that contains a value.  The
 user would have to click the submit button for the variable/value to carry
 over though.
 
 Tyler Longren
 Captain Jack Communications
 [EMAIL PROTECTED]
 www.captainjack.com
 
 - Original Message -
 From: Daniel Alsén [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Sent: Tuesday, April 02, 2002 9:02 AM
 Subject: [PHP] Passing a variable invisibly via a href?
 
 
  Hi,
 
  i need to pass a variable by letting the user click on a link. Right now i
  do it like: page.php?variable=value
 
  However, i don´t want the variable, and it´s value to appear in the adress
  bar of the browser. And i don´t want people to be able to pass the same
  variable by reloading the destination page.
 
  Any pointers on how i can do this?
 
  Regards
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 705 38 10 30 #
  # ICQ: 63006462   | +46 8 694 82 22  #
  # PGP: http://www.mindbash.com/pgp/  #
 
 
  --
  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
 

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




SV: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

 You could use a form and have a hidden vield that contains a value.  The
 user would have to click the submit button for the variable/value to carry
 over though.

I thought about that. But i have two possible values (via two links) that
could be passed and i can´t really get it together. Two forms?

- Daniel


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




Re: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Tyler Longren

That might not be such a good idea then.

Tyler

- Original Message -
From: Daniel Alsén [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 9:11 AM
Subject: SV: [PHP] Passing a variable invisibly via a href?


  You could use a form and have a hidden vield that contains a value.  The
  user would have to click the submit button for the variable/value to
carry
  over though.

 I thought about that. But i have two possible values (via two links) that
 could be passed and i can´t really get it together. Two forms?

 - Daniel


 --
 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] Passing a variable invisibly via a href?

2002-04-02 Thread Adrian Murphy

or use javascript href=javscript:form.submit()
or if you really wanted you could encrypt the variable
pass it via the url and then decrypt it on the next page!
to avoid a reload  put no-cache in the header.
- Original Message -
From: Daniel Alsén [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 4:02 PM
Subject: [PHP] Passing a variable invisibly via a href?


 Hi,

 i need to pass a variable by letting the user click on a link. Right now i
 do it like: page.php?variable=value

 However, i don´t want the variable, and it´s value to appear in the adress
 bar of the browser. And i don´t want people to be able to pass the same
 variable by reloading the destination page.

 Any pointers on how i can do this?

 Regards
 # Daniel Alsén| www.mindbash.com #
 # [EMAIL PROTECTED]  | +46 705 38 10 30 #
 # ICQ: 63006462   | +46 8 694 82 22  #
 # PGP: http://www.mindbash.com/pgp/  #


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




SV: SV: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

 Yes, there is a way to do it without using any forms.  I may be able to
 help you better if you could show me the relevant code -- I'm not sure
 if what I have in mind is really applicable to what you want to do.

It´s not really advanced:

session_start();
session_register('text_size');

if ($change == inc) {
$text_size++;
}
elseif ($change == dec) {
$text_size--;
}

I use the variable $change to set the text size in my stylesheet:

if (isset($text_size)) {echo $text_size;} else {echo 10; $text_size = 10;}

And i set the variable via a link:

a href=? echo $PHP_SELF; ??change=inc (or change=dec)

Now - i don´t want the variable to be visible. And i would prefer if the
variable didn´t get set every time someone hit reload.

Or am i attacking this changing-text-size-thingy the wrong way?

- Daniel


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




Re: SV: SV: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Erik Price


On Tuesday, April 2, 2002, at 10:28  AM, Daniel Alsén wrote:

 I use the variable $change to set the text size in my stylesheet:

 if (isset($text_size)) {echo $text_size;} else {echo 10; $text_size = 
 10;}

 And i set the variable via a link:

 a href=? echo $PHP_SELF; ??change=inc (or change=dec)

 Now - i don´t want the variable to be visible. And i would prefer if the
 variable didn´t get set every time someone hit reload.

 Or am i attacking this changing-text-size-thingy the wrong way?

Hmm.  I thought that I had a clever solution for you, but I don't.  The 
one that I came up with would probably be far more complex and inelegant 
than you would ever want to use.  If you were submitting your data to a 
database or some kind of service, then it would work (I am thinking of 
the PostToHost() function in the archives), but since you are trying to 
set a session variable, you really need to refresh the page in the 
process.  This means that either using a form with POST data or the 
querystring method that you mention above is really the best way to do 
it.

If you used a form with POST data, you'd probably want to use radio 
buttons or make a little listbox and a submit button, like:

form method=post action=?php echo $_SERVER['PHP_SELF']; ?
select name=change
  option value=incIncrease Size/option
  option value=decDecrease Size/option
/select
/form

This would keep your querystring/URL free of extra data like 
page.php?change=inc.



Erik




Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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