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

 How do you store a UserID session variable in a textbox?

Print topic Send  topic

Author Message
truffles

Posts: 1
Posted: 04/08/2009, 10:18 PM

Hi,

I am using MySQL and PHP and am trying to create a form that will store the UserID session variable into an SQL table called 'ems_device' upon clicking the 'Submit' button. I need it to store the session variable in the textbox before the submit button is clicked though, not stored directly into the database.

The record stores 5 fields into the 'ems_device' table, however I want one of the fields, 'owner_id' to automatically receive (before_show) the UserID session variable).

I've tried;

$owner_id = CCGetUserID();
$ems_device_owner_id = CCGetUserID();
$ems_device3_owner_id_BeforeShow = CCGetUserID();

but it keeps returning with errors.

does anyone know how I can get this to work?

Thanks, & Best Regards,

Levi



View profile  Send private message
melvyn


Posts: 333
Posted: 04/08/2009, 11:06 PM

Are you using CodeCharge Studio?

If so:

Place a hidden control in the form and set it's default value to CCGetUserID()

Or you can place an event in BeforBuildInsert as $Container->owner_id->SetValue(CCGetUserID())


_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
tomcatsolutions

Posts: 11
Posted: 06/22/2009, 10:39 AM

I am also really struggling with something like this. For many weeks now I am trying to set a session variable when I login and get the value out to the screen. It seems that every solution posted in these forums simply does not work! Does anyone actually know how to do it? If so can they please post a solution here.

I think I have got as far as setting the Session variable but since I cannot get a Session variable I cant tell.
place an event in BeforBuildInsert as $Container->owner_id->SetValue(CCGetUserID())
and
A way to test this (PhP) is to add a label to a page, BeforeShow set it to $Component->SetValue( CCGetSession("sess_firstname","XXX") );
DOES NOT WORK!! it just causes a blank page.

I would really appreciate some good answers, we are considering dropping CCS as a development tool as it is really SO difficult to do what should be simple things.


_________________
Hosted web applications and services.
http://SaaSZone.com
View profile  Send private message
robertmann

Posts: 109
Posted: 06/22/2009, 11:48 AM

Wow, it was not enough to ask for help but you need to threaten whole community with dropping CCs because you cannot do simple things that everyone else is doing every day? I was telling YS for years to drop such people. Why don't you start a losers club for people who cannot do anything and blame tools and threaten professionals. Or go to school before getting into app dev biz.
_________________
Robert
View profile  Send private message
aondecker

Posts: 58
Posted: 06/22/2009, 12:09 PM

Quote tomcatsolutions:
I am also really struggling with something like this. For many weeks now I am trying to set a session variable when I login and get the value out to the screen. It seems that every solution posted in these forums simply does not work! Does anyone actually know how to do it? If so can they please post a solution here.

I think I have got as far as setting the Session variable but since I cannot get a Session variable I cant tell.
place an event in BeforBuildInsert as $Container->owner_id->SetValue(CCGetUserID())
and
A way to test this (PhP) is to add a label to a page, BeforeShow set it to $Component->SetValue( CCGetSession("sess_firstname","XXX") );
DOES NOT WORK!! it just causes a blank page.

I would really appreciate some good answers, we are considering dropping CCS as a development tool as it is really SO difficult to do what should be simple things.




It could be your php.ini. Whenever i have problems with computers and session variables, i go into the php.ini and change the session folder in there to a folder that i made.. (like. c:\php_session). Problem goes away.


EDIT.. make sure you restart your computer or restart the World Wide Web Publishing Service so your php.ini changes get read.
View profile  Send private message
tomcatsolutions

Posts: 11
Posted: 06/22/2009, 12:21 PM

Actually I have been in the app dev biz for many years and very successfuly. This is a new thing I am trying and on a basic level it seems good. The generation side of this tool is great, it's quick and easy to do most things and get a very basic app running.
However, when it comes to custom code and more advanced work it has to be said: documentation is very vague and many suggestions to problems here just don't work.
You also have to appreciate that it is a very different approach to coding and without quality help it is extremely difficult tool to use for advanced stuff, some things are far simpler hand coding.

I found a very nice article on how to insert Session variables here:
http://forums.yessoftware.com/posts.php?post_id=97110&s...=custom+session
but then right at the end the: BeforeShow set it to $Component->SetValue( CCGetSession("sess_firstname","XXX") ); Does not work and it seems typical of what I am finding.

I am pleased you have figured out how to insert working custom code and you use it every day. perhaps you can post a few working example in these forums and do everyone a favor!

_________________
Hosted web applications and services.
http://SaaSZone.com
View profile  Send private message
GeorgeS

Posts: 206
Posted: 06/22/2009, 1:18 PM

I'd follow aondecker's suggestion because Walter's solution (http://forums.yessoftware.com/posts.php?post_id=97110&s...=custom+session) just worked for me - I created a new login page with a label and login form.
It took me ~ 2 minutes.
The only different thing that I did was setting DlookUp action property Convert result to: Text (instead of Integer)
_________________
GeorgeS
View profile  Send private message
robertmann

Posts: 109
Posted: 06/22/2009, 1:42 PM

Im not at computer to test, but you said about using before build insert to set session var when login. But login doesn't insert anything and such event is not used. So maybe you need to use another event or modify login action. As for showing session var maybe it was never created, but you can use standard php with echo command to investigate. So you dont need to use label but just std echo and if nothing is shown then the problem is not with showing something but not creating smthg. And you can use std PHP to create session var. If std PHP doesnt work then the tool will not make a difference.
_________________
Robert
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.