RE: [PHP] PHP4 & sessions & functions
| From: | John Coggeshall | Date: | Sun, 30 Jul 2000 15:38:55 +0000 |
| Subject: | RE: [PHP] PHP4 & sessions & functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9015@lists.php.net to get a copy of this message | ||
That's because you aren't passing the session ID. You have to do something
like this:
<A HREF=test.php3?session_id=<? echo session_id(); ?>>Test</A>
Without cookies, the session data needs to be transmitted via an GET Method
Post.
John
-----Original Message-----
From: Howard Martin [mailto:howard@koalanet.com.au]
Sent: Saturday, July 29, 2000 9:53 PM
To: php-general@lists.php.net
Subject: [PHP] PHP4 & sessions & functions
I've got a page where I pass info to a form which is then emailed to
me. The info at present is passed by using:
form.html?name=Howard&item=apple
but I'd like to be able to use sessions to make it a cleaner URL.
I've got php4.0.1pl2 installed on an Apache server with trans_sid
enabled:
--enable-trans-sid=yes
Condensing the whole thing as much as possible I've got the following
three files:
page1.html
<?php
session_register("ref");
session_register("name");
require "session.func";
$ref = "apple";
$name = "Howard";
refname();
?>
form.html
<?php
session_start();
echo "$name has one $ref<BR>\n";
?>
session.func
<?php
function refname(){
global $name;
global $ref;
echo "<A HREF='form.html'>Continue</A><BR>\n";
}
?>
This works fine and form.html prints "Howard has one apple" with
cookies enabled but prints only "has one" with cookies disabled.
The session_id is clearly not getting passed to form.html and I
wonder whether anybody can shed any light on the matter. Having
trans_sid enabled means (I think) I shouldn't have to use <? SID ?>
Howard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net