Actually, now when I test it out, I get "Resource id
#3orgidcopy" (my recordset field is called orgidcopy and appears
as" Recordset1.orgidcopy") instead of the data from the recordset.
What's going on?
Nancy - Adobe Comm. Expert wrote:
> And now you know why I don't really like PHP. :)
> Hasn't PHP changed the way you do this several times
during its evolution ..
> so what version of PHP is on the server would make a
difference?
Not several times, no. Sessions were first introduced in PHP
4.0.0 (May
2000) and used the session_register() syntax. The $_SESSION
syntax was
introduced in PHP 4.1.0 (December 2001).
The session_register() syntax doesn't work if
register_globals is off.
This has been the default setting since PHP 4.2.0 (April
2002), although
some ill-advised hosting companies turn it back on. The
register_globals
directive, if turned on, automatically creates variables
derived from
the name of input elements. So, for example, the value of a
text field
called "email" is automatically stored in a variable called
$email. Very
convenient, but a massive security hole. PHP 6 will remove
register_globals permanently.
So, yes, session creation changed in the early days, but the
recommended
method (using the $_SESSION syntax) has remained stable for
the past
five years.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
And now you know why I don't really like PHP. :)
Hasn't PHP changed the way you do this several times during
its evolution ..
so what version of PHP is on the server would make a
difference?
Thanks for the link,
Nancy
"David Powers" <david@example.com> wrote in message
news:f666uj$mst$1@forums.macromedia.com...
> Nancy - Adobe Comm. Expert wrote:
>> PHP sessions are more complicated.
>
> No, they're not.
>
>> You also have to start and register sessions like
this:
>>
>> <?php session_start(); // This connects to the
existing session
>> session_register ("name"); // Create a session
variable called name
>> session_register ("job"); // Create a session
variable called job
>> $HTTP_SESSION_VARS ["name"] = $name; // Set name =
form variable
>> $name
>> $HTTP_SESSION_VARS ["job"] = $job; // Set job = form
variable $job
>> ?>
>
> No, no, no!!! That is deprecated code that will break on
most modern
> servers. This is the correct way to write the above
example.
>
> <?php
> session_start();
> $_SESSION['name'] = $name;
> $_SESSION['job'] = $job;
> ?>
>
> If you're using form variables sent by the POST method,
then it should be
> this:
>
> <?php
> session_start();
> $_SESSION['name'] = $_POST['name'];
> $_SESSION['job'] = $_POST['job'];
> ?>
>
> For more information about PHP sessions:
>
http://www.php.net/manual/en/ref.session.php >
> --
> David Powers, Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "PHP Solutions" (friends of ED)
>
http://foundationphp.com/
Gabe the Animator wrote:
> But I'm dealing with putting the information from a
recordset into a session
> variable. I don't know what form variables are. Also,
why do I need TWO session
> variables? Why can't I just use one for the recordset
field I'm storing?
It sounds as though you are shooting completely blind. The
two variables
are examples. You can have as many or as few session
variables as you
want. To create session variables in PHP there are two
requirements:
1. You must start the page with this
session_start();
2. To create a session variable, do this:
$_SESSION['variable_name'] = variable_value;
Replace variable_name with the name that you want to use for
the
variable. Replace variable_value with whatever you want to
store.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/