Re: setting session variables via a form

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

 



hi!

i know that it sends everything to itself if you omitt the action-attribute, but it isn't propper html strict anymore... (ok - thats not a big problem *g*)

maybe it helps if you put the testing in a place of the script where there was no output yet (also no whitespaces)? at least this is a requirement for session_start(). probably similar things have to be considerd vor $_SESSION['foo'] = 'bar';

.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 20:04 Uhr schrieb Becoming Digital:

maybe try the invers (anyways you havn't defined an action-attribute -
maybe this is a problem?):

Not declaring an action attribute automatically makes the form submit to itself.
When a URL query string is involved, this works much better than
$_SERVER['PHP_SELF'], which reduces the URL to its basic format.



'<input  name="view_details" type="hidden" value="yes">'.
'<input type="submit" value="View Descriptions">'.

That helped, to a degree. The submit button was key to getting the form to
register (hiding the button) but it's still not registering the session
variable.


Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message ----- From: ".ma" <grillen@abendstille.at> To: "PHP-DB" <php-db@lists.php.net> Sent: Monday, 16 June, 2003 11:57 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