Re: setting session variables via a form

From: Date: Mon, 16 Jun 2003 15:57:00 +0000
Subject: Re: setting session variables via a form
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28643@lists.php.net to get a copy of this message
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


« previous php.db (#28643) next »