CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Newbie that needs help

Print topic Send  topic

Author Message
dmccollum

Posts: 2
Posted: 01/02/2004, 7:54 AM

Hello everyone,

It's been a looong time since I've done any web development and I'm just starting out with CCS. I'm running CCS 2.2.2.40 with Apache 2, MySQL, and PHP 4. The first couple areas that I need some assistance with are:

1. How do I place a label with the login id visible or a "Not Logged in" if they have not logged in yet?

2. I'm working with a database where users can enter some information. I have the forms working with one exception, I need to retrieve the user_id to insert into the row. What I'd like to do is have the text box invisible or where they can't change the data and have the form pull the user's id from the session information.

Thanks,

Don
View profile  Send private message
VBAjedi


Posts: 34
Posted: 01/02/2004, 4:45 PM

Don,

I'm pretty new as well, but I think I can point you in the right direction on #1. In design mode, type the following where you want the user ID to appear:

{GreetUser}

Now add the following line somewhere in the _BeforeShow event of the desired page (I put mine in my site header so it's visible on every page):

$Tpl->SetVar("GreetUser","You are logged in as: " . CCGetUserID());

Obviously you can remove the text preceding the User ID if you don't want it.

Hope that helps a bit! I can't give you a complete answer to #2, but it will probably involve the CCGetUserID() function. . .
_________________
VBAjedi
jedi at NOSPAM dot obie dot com
View profile  Send private message
RonB

Posts: 228
Posted: 01/03/2004, 3:42 AM

1. an adaption of VBAjedi code:
global $Tpl;
if (CCGetUserID() <> "")
{
$Tpl->SetVar("GreetUser","You are logged in as: " . CCGetUserID());
}
else $Tpl->SetVar("GreetUser","You are not logged in");

2. add a hidden box assign it to the field that will hold the user id in your table and do a before show event for that hidden field:

$gridname->hidden1->setvalue(CCGetUserID());

Ron
View profile  Send private message
dmccollum

Posts: 2
Posted: 01/03/2004, 9:23 AM

Ron,

Thanks the first example works fine, but I can't get the second one to work. It makes the entire page invisible, I guess I'm putting the code in the wrong place. I just can't figure out how.

Thanks,

Don
View profile  Send private message
RonB

Posts: 228
Posted: 01/05/2004, 9:49 AM

the hidden field you have to create in design view. Not in an event. it's just a textbox but hidden. You can ad one by choosing it from the froms tab in the toolbox. After you added the hidden field you do a before show event and iuse the given code.

Ron
View profile  Send private message
Nicole

Posts: 586
Posted: 01/06/2004, 5:36 AM

Quote RonB:
the hidden field you have to create in design view. Not in an event. it's just a textbox but hidden. You can ad one by choosing it from the froms tab in the toolbox. After you added the hidden field you do a before show event and iuse the given code.

Ron

In addition to it:
you can put CCGetUserID() right into Hidden field Default Value property

_________________
Regards,
Nicole
View profile  Send private message

Add new topic Subscribe to topic   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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