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:[EMAIL PROTECTED] > Sent: Monday, June 16, 2003 11:57 AM > To: PHP-DB > Subject: Re: [PHP-DB] 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: [EMAIL PROTECTED] > 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