Re: help with session

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

 



I would go for:

    if (isset($_REQUEST['gender'])) $_SESSION['registrationGender'] =
$_REQUEST['gender'];
    print isset($_SESSION['registrationGender']) ? "You are registered as
gender: ".$_SESSION['registrationGender'] : "Your gender is unknown";

And make no assumptions about a gender when you don't know any ;-)

On 26/08/07, Jason Cartledge <jason1096@xxxxxxxxxxxxx> wrote:
>
>
> Hi, this is my first post to this newsgroup. Does this code look ok or is
> there a more clean way of doing this? I am learning. Thank you for reading.
> Jason
>
>    if ( !empty($_REQUEST['gender']) )
>           {
>             $registrationGender=$_REQUEST['gender'];
>           }
>           else {
>                  if (session_is_registered('registrationGender'))
>                   {
>                    $registrationGender=$_SESSION['registrationGender'];
>                    print "you are preregistered as a $registrationGender";
>                   }
>                   else
>                   {
>                    print "your gender is unknown, youare assumed to be a
> male";
>                    $registrationGender="male";
>                   }
>                }
>
>         $_SESSION['registrationGender']=$registrationGender;
>
> _________________________________________________________________
> 100's of Music vouchers to be won with MSN Music
> https://www.musicmashup.co.uk/index.html
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Interpotential.com
Phone: +31615397471

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux