Re: [phplib] hidden variable or session variables? From: marion schmid (schmid <email protected>)
Date: 06/27/01

Hello!
I think this has to do something with session-variables. Hidden
variables is not a good solution because
in case you have many variables to store, the URI is getting longer and
longer. I had a similar problem with forms and values
and the only good solution were session variables. Since PHP 4 you have
session-variable-functionality. I
solved my problem with the PHPLIB-session, that is with the help of

$sess->register("value");
$sess->unregister("value");

Beware of setting the register / unregister function at the right
position and that the variables could then be
overwritten of "" . At first I had them at the top of
the script instead of just where some values had to written in the
session-variables. Don't register
within/before the <FORM>. I had my unregister functions after the form.

example:

if (mode=="" || mode=="correct")
{
<form method="POST" action="<?php $sess->pself_url() ?>"
enctype="application/x-www-form-urlencoded" name="eintragen"> Value is:
                     <input type="text" name="value" value="<?php echo $value ?>"
size="30">
                     <input type="submit" name="mode" value="eintragen">
</form>
<?php
  $sess->unregister("value");
}

elseif ($mode == "submit") {
                if($value) {
                     
                             $sess->register("value");
                     <a href="<?php $sess->purl("file.php4?mode=correct")
?>">correct,please!</a><br><br>
}
and so on...

The idea behind this was, that I can correct the values in the form,
after I did the first submit and wanted to correct the value. By use of
session-variables the value was shown in the input fields of the form
again. I corrected the value. The unregister-function was necessary that
the corrected value is stored in the session variable

hope this helps you with session-variables

/marion
 

Ralf Pfeiffer wrote:
>
> Part 1.1 Type: Plain Text (text/plain)
> Encoding: quoted-printable

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>