Re: setting session variables via a form

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

 



> 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


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

  Powered by Linux