pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jules Alberts <jules.alberts@arbodienst-limburg.nl>
To: pgsql-php@postgresql.org
Subject: variable visibility when using <a href></a>
Date: Wed, 29 May 2002 16:46:15 +0200
Message-ID: <200205291453.g4TErRFP005339@artemis.cuci.nl> (raw)

hello world,

sorry if this is off topic, but the question arose when i was buidling 
a test system with PHP4 / postgresql.

i want a user to enter a user ID and password in order to make a non-
permanent database connection. so the application (that consistes of 
several PHP and HTML files) should remember the values in variables.

a logical approach seemed to be global variables, however, this doesn't 
work when new pages are generated. in this small example:

	// this is file main.php
	<?php
  	echo "<html><body>";
	  $password="fubar";
  	echo "password is: \"$password\"<br>";
	  echo "<a href='sub.php'>sub</a>";
  	echo "</body></html>";
	?>

	// this is file sub.php
	<?php
  	echo "<html><body>";
	  global $password; // doesn't work
  	echo "password is: \"$password\"<br>";
	  echo "</body></html>";
	?>

the variable $password is not visible in sub.php. i guess this is 
because the href link creates a new page, a fresh start. still i want 
$password to be visible in sub.php. what is a good, safe way to do 
this? setting serverside environment variables sounds dangerous. and i 
would like to avoid cookies (unless it's the only way). i thought about 
include_once(), but you can't call that from a link. or can you?

how is this normally done? TIA for any tips!

-- 
Jules Alberts



view thread (3+ messages)  latest in thread

Message-ID: <200205291453.g4TErRFP005339@artemis.cuci.nl>
Permalink:  ../200205291453.g4TErRFP005339@artemis.cuci.nl/
Also on:    postgresql.org/message-id/200205291453.g4TErRFP005339@artemis.cuci.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: jules.alberts@arbodienst-limburg.nl
  Subject: Re: variable visibility when using <a href></a>
  In-Reply-To: <200205291453.g4TErRFP005339@artemis.cuci.nl>
  References: <200205291453.g4TErRFP005339@artemis.cuci.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox