Re: setting session variables via a form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Are you certain that you have issued the session_start() call at the
> beginning of the page?

100%.  I went so far as to move session_start() before every other element on
the page, even removing it from my include file and directly inserting it into
the actual page.

> Furthermore, your register_globals setting will have some impact on your
> syntax.

Mike answered that part quite nicely.  I just realized that I had
register_globals = On, but that is now changed and I still have the same result.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Hutchins, Richard" <Richard.Hutchins@Getingeusa.com>
To: "PHP-DB" <php-db@lists.php.net>
Sent: Monday, 16 June, 2003 12:07
Subject: RE:  setting session variables via a form


Edward,

Are you certain that you have issued the session_start() call at the
beginning of the page? According to the session stuff on PHP.NET, you need
to make sure you have session_start() at the top of the page before you do
anything else with the session. For example, I have on one of my simpler
pages:

session_start();
session_register("isRegistering");

$_SESSION["isRegistering"] = "true";

header("Location: http://mywebsite.php";); /* Redirect browser */

Furthermore, your register_globals setting will have some impact on your
syntax.

See http://us3.php.net/manual/en/ref.session.php

Hope that helped.

Rich

> -----Original Message-----
> From: .ma [mailto:grillen@abendstille.at]
> Sent: Monday, June 16, 2003 11:57 AM
> To: PHP-DB
> Subject: Re:  setting session variables via a form
>
>
> hi
>
> maybe try the invers (anyways you havn't defined an
> action-attribute -
> maybe this is a problem?):
>
> if(!isset($_SESSION['item_details']) || (
> isset($_SESSION['item_details'] && $_SESSION['item_details']) {
> echo '<form name="myForm" method="post"
> action="'.basename($_SERVER['PHP_SELF']).'">'.
> '<input  name="view_details"
> type="hidden" value="yes">'.
> '<input type="submit" value="View
> Descriptions">'.
> '</form>';
> else
> $_SESSION['item_details'] = 'yes';
>
> hope i understood you right and this helps?
>
> .ma
>
> e: grillen@abendstille.at
> w: http://www.abendstille.at
>
> # life would be easier if i knew the source code
>
> Am Montag, 16.06.03 um 17:16 Uhr schrieb Becoming Digital:
>
> > Despite my best efforts, I can't seem to set session
> variables via a
> > basic form.
> > I'm trying to use a button to alter display settings, which
> should be
> > a simple
> > task, but apparently it is not.  Here's the code I'm working with.
> >
> > <?
> > if( (!isset( $_POST['view_details'] )) &&
> ($_SESSION['item_details']
> > != "yes") )
> > {
> >         print "<form method=\"post\">";
> >         print "<input type=\"button\" name=\"view_details\"
> > value=\"View
> > Descriptions\" />";
> >         print "</form>";
> > }
> > else
> >     $_SESSION['item_details'] = "yes";
> > ?>
> >
> >
> > My session I have tried a number of different solutions, including
> > removing
> > session_start() from its calling function and various
> things I might
> > otherwise
> > overlook.  I'm sure that I'm overlooking something easy but I can't
> > figure out
> > what it is.  The session variable simply isn't being set,
> as confirmed
> > by
> > printing its value (and by things not working!).  Thanks a
> lot for any
> > and all
> > suggestions.
> >
> > Edward Dudlik
> > Becoming Digital
> > www.becomingdigital.com
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux