Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Passing Value

Quote Reply
Passing Value
Would like to pass a value to another page without using <form></form>. Using this to "Email Page To Friend"

Rough Example - where $WebPage is

<?php
$scriptname = getenv("SCRIPT_NAME");
$httphost = getenv("HTTP_HOST");
$WebPage = "http://www." . $httphost . $scriptname;
?>

<a href="MailToPage.php?$WebPage">Mail This To Friend</a>
Quote Reply
Re: [gatman] Passing Value In reply to
Mmm...not sure what you mean. To see all the available variables to the PHP scripts, try adding;

Code:
foreach ($GLOBALS as $word => $val)
{
print "$word => $val";
}

Then call the variable with $GLOBAL['VarName']

Hope that helps Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Passing Value In reply to
I have the variables. I wanted to pass it(them) to another page (in the page - not the address bar) using a hyperlink instead of using <form>

make sense?
Quote Reply
Re: [gatman] Passing Value In reply to
Like;

page.php?VarName=1234&AnotherVar=abc&anotherOne=testing

Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [gatman] Passing Value In reply to
As indicated by Andy, there are three (that I can think of) ways to pass values between pages:

1) via a form

2) via the URL (not necessarily mutually exclusive from #1)

3) by writing the data to a file or database and reading it in on the subsequent page

It sounds like #2 is what you want. What you do with that depends on what exactly you want to do...

Dan
Quote Reply
Re: [Dan Kaplan] Passing Value In reply to
You could also have the data written to a cookie which is read by the next page:

setcookie ("cookiename", $value);


Then read the data from the next page.


Gordon
Quote Reply
Re: [gsm] Passing Value In reply to
Ah yes, make that 4. :-)

Dan
Quote Reply
Re: [Dan Kaplan] Passing Value In reply to
I have a cookie to pass information to the next page. The cookie is only written if a user logs in, how do I check on the next page that the cookie has been written (thus a user has logged in)?
Quote Reply
Re: [conundrum] Passing Value In reply to
if (isset($_COOKIE["cookie_name"])) {

or:

if (isset($_SESSION["cookie_name"])) {
...

Dan

Last edited by:

Dan Kaplan: Jan 20, 2003, 9:56 PM
Quote Reply
Re: [gatman] Passing Value In reply to
in PHP the variable name passed through the URL is the variable used in PHP. Therefore if you wanted to pass

http://www.yoursite.com?scriptname=emailscript&httphost=hostname&webpage=yourpage.html

then PHP would recognize these as the following variables

Code:
$scriptname
$httphost
$webpage
therefore you can use them in a server side function. Hope this helps.

Jay
Quote Reply
Re: [capitoljay] Passing Value In reply to
Not with newer versions of PHP where register_globals is turned off by default. You really shouldn't write code that relies on register_globals being turned on. Some reasons here:
http://www.php.net/....registerglobals.php

Adrian
Quote Reply
Re: [brewt] Passing Value In reply to
Consistency across servers is a good reason to work around register_globals, but security is a very weak and ill-formed argument (that isn't directed at Adrian). All register_globals does is eliminate very sloppy coding holes, but even its "strengths" can easily be gotten past by someone determined to hack a script (which is pretty much the definition of anyone the subject of such concerns).

Dan