PHP4 & sessions & functions
| From: | Howard Martin | Date: | Sun, 30 Jul 2000 01:53:23 +0000 |
| Subject: | PHP4 & sessions & functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9012@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();
?>
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