PHP4 and sessions and functions
| From: | Howard Martin | Date: | Sat, 22 Jul 2000 21:24:29 +0000 |
| Subject: | PHP4 and sessions and functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7720@lists.php.net to get a copy of this message | ||
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();
?>
page2.html
<?php
session_start();
echo "$name has one $ref<BR>\n";
?>
session.func
<?php
function refname(){
global $name;
global $ref;
echo "<A HREF='page2.html'>Continue</A><BR>\n";
}
?>
This works fine and page2.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 page2.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