CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Passing session vars to record form?

Print topic Send  topic

Author Message
Rolf
Posted: 07/04/2002, 1:20 AM

Page "Anmeldung":
From a grid form on the preceding page, I let users choose one record
and have it displayed in a separate form (grid) on this page (Anmeldung).

Next to this form I have an other form (record) that
links to a separate table, where I want to enter
the registration: ver_nr_id and op_partner_id

The variables for the fields ver_nr_id and op_partner_id
have both been declared session variables :

set_session("op_Partner_ID", $db->f("op_partner_id"));

Done at the Login page - events - "Close"

and on the page Anmeldung, the grid form with the one record
that is passed, events - "Before Show"

set_session("ver_nr_id",$ver_nr_id);

For some reason it appeas that these session variables do not
register, I'm testing their appearance with an echo statement
in the record form: events - "Before Show"

echo "$ver_nr_id";
echo "$Pers_ID";
echo "$op_Partner_ID";
echo "Test";

The only one that shows up on screen is "Test"....

Appreciate any hints what I'm missing, Tks!
Rolf


Rolf
Posted: 07/04/2002, 1:39 AM

Sorry, forgot to mention system etc..
Nicole
Posted: 07/05/2002, 5:28 AM

Rolf,
1. to set session variable use code:
set_session("ver_nr_id",$fldver_nr_id);
if "ver_nr_id" is the field on the form;
2. to access session var values use:
echo get_session("ver_nr_id");

3. to "automatically" register user you can add Hidden fields to the form and assign them Default values like:
=date("Y-m-d HH:nn:ss");
in field properties or create Before Inert event and enter values there, e.g.:
$fldfiel_name = get_session("ver_nr_id");
Rolf
Posted: 07/06/2002, 7:39 AM

Thank you Nicole!

The session variable "ver_nr_id" now shows up in the DB, so
I'm a step further. Much appreciate your hint.

What's still puzzling me is the session variable I try to take from the
Login page:

This is my table structure for the Login:

CREATE TABLE op_admin (
user_id mediumint(9) NOT NULL auto_increment,
op_partner_id varchar(64) default NULL,
op_partner_pw varchar(64) default NULL,
zugangsrecht_id varchar(32) NOT NULL default '',
PRIMARY KEY (user_id),
) TYPE=MyISAM;

I can't use UserID, because this is not the Login key. We're using op_partner_id as the user name.

I'm declaring it on the Login Page / Login Form / Event: Close
as follows (using part of the custom login example from the CC Help
file):

------------
$sLogin = get_param("Login");
$sPassword = get_param("Password");
$db->query("SELECT zugangsrecht_id,op_partner_id,pers_id FROM op_admin WHERE op_partner_id =" . tosql($sLogin, "Text") . " AND op_partner_pw=" . tosql($sPassword, "Text"));
$is_passed = $db->next_record();

if($is_passed)
{
//-------------------------------
// Login and password passed
//-------------------------------
set_session("PERS_ID", $db->f("pers_id"));
set_session("OP_PARTNER_ID", $db->f("op_partner_id"));
set_session("ZUGANGSRECHT", $db->f("zugangsrecht_id"));
}
else
{
$sLoginErr = "Login or Password is incorrect.";
}
------------

Then on the page Anmeldung, where I'm using the registration process
with the hidden field in the record form, I'm calling this session
variable to be enterd into the record form field:

$fldop_partner_id = get_session("OP_PARTNER_ID");

The registration process takes place upon hitting the "Enter"
button and results in a new recod in the DB table
that is holding the value for ver_nr_id, but leaves the
record field op_partner_id as "NULL" ... ??? It should pass the
value entred by the user whe login in.

I've been playing around with this for hours now, but seem to
be missing something (small?) somewhere.

Appreciate any ideas or suggestions!

Rolf
Nicole
Posted: 07/08/2002, 1:14 AM

Rolf,
PHP is case sensitive, make sure that you type variable names in the same case.
You can also print session var values in testing purposes right after they are created on Login form and somewhere else to check if the session is stored or expired.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.