[FX.php List] Variables and Sessions

Laura Long laural at ultimate-products.com
Sun Feb 12 10:29:51 MST 2006


I am a php programmer in training, lol... I have a question.  I have a
database that holds all of my users.  I have a "Login" database that
works with my php page and creates a new record every time someone logs
in.  I pass an id, the username and the password to create a string
which is used as a key to match a record in the company database.  Then
the login page does lookups based on that key and brings in all of the
users information to that database.  That all works fine.

Here is where I get stuck.  I would like to begin a session on the
Results page that will use the value in one of the fields in the login
database (the field is called services), and then the rest of my php
site will reference the value of services to bring in information.  I
can begin a session and set the variable to one of the 3 fields that was
in the login form, or to a static value, but I do not know how to
reference the services field in the login database to use as the value
for my session.  I hope this makes sense, I will post the code below:

Login Page: Here is the portion of code that contains my form:

<form action="result.php" method="post">

                  <td align=right colspan="3">
                    <div align="left">Please enter your <i>Username</i>
and <i>Password</i>
                      to access Work Life Services. </div>
                  <td align=right width="64">Username:</td>
                  <td align=left colspan=2 width="211">
                    <input type=text name=username value="" size=20>
                  <td align=right width="64">Password:</td>
                  <td align=left colspan=2 width="211">
                    <input type=password name=password value="" size=20>
                  <td align=right valign=top width="64">&nbsp;</td>
                  <td align=right colspan=2 width="211">
                  <input type="hidden" name="idUser" value="1045">
                    <input type="submit" name="Submit" value="Submit">

Result Page: where the session is supposed to be set: where usename is
registered, I would like to pull the value of the field services:

session_start( );


$login=new FX($serverIP,$webCompanionPort,'FMPro7');

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="webstyle.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

print "Your name is: ";
print $username;

Error Code: <?php echo $loginResult['errorCode']; ?> <br>
Found Count: <?php echo $loginResult['foundCount']; ?> <br>
<table width="400" border="0" align="center" cellpadding="2"
<?php foreach($loginResult['data'] as $key=>$loginData){ ?>
    <td><? echo $loginData['username'][0]; ?>&nbsp;&nbsp;</td>
    <td><? echo $loginData['password'][0]; ?>&nbsp;</td>
<? } ?>
<a href="session2.php">Continue</a>

More information about the FX.php_List mailing list