473,763 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help seeing Session vars from Include scipts

I am new to php and need some help getting the session variables into
include files. (after-thought, Sorry for the drawn out post but I
really, really need help....;)

Here's what I'm doing..

I have a php request_form that I use 2 different ways: by itself (url
directly to the form) and as an include to be displayed in existing
php pages. This form uses POST to another php_script that performs
serverside validation and db write. If all go's well then a write to a
mySQL table and a redirect to a confirm page. I have been using this
form for months and it works great.

Here's what I'm having trouble with..(I'm now 'trying' to use Sessions
and query strings)

I am using _GET to retrieve query-string vars to set as _SESSION vars
to eventually be written to the db with the form data. When I use the
form by itself (direct url), everything works like a charm! The
session vars are available to the serverside script and are written
the db. If I use it as an include in an existing page, neither the
form or the serverside script can access the session vars, although
the 'existing page' and the confirm page can!

The session vars are there through out the whole process because the
confirm page is the last step and the session vars are there and
available. Why can't I use see the session vars when the form is used
as an include??

Any help or direction would be GREATLY appreciated. I have searched
and the boards for hours with no luck.

James

Setup:
FreeBSD 4.4
PHP 4.3.0
Register Globals - off
session.auto_st art - off
session.save_ha ndler - files
session.use_coo kies - on
session.use_tra ns_sid - on

Code (when using form as an include absolute url is used with
require())
/////////////////////////////////////////////////////////////////////
Top of 'an existing' php page:
<?php
session_start() ;
$_SESSION['session_cmpid'] = $_GET['cmpid'];
$_SESSION['session_engid'] = $_GET['engid'];
$_SESSION['session_kwid'] = $_GET['kwid'];

$campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
echo 'Campaign is '.$campaign;
?>
///////////////////////////////////////////////////////////////////////
Top of form script:
<?php
session_start() ;
$_SESSION['session_cmpid'] = $_GET['cmpid'];
$_SESSION['session_engid'] = $_GET['engid'];
$_SESSION['session_kwid'] = $_GET['kwid'];

$campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
echo 'Campaign is '.$campaign;
?>
//////////////////////////////////////////////////////////////////////
Top of serverside script:
<?php
session_start() ;
if (!isset($_SESSI ON['session_cmpid']))
{
$campaign="100" ; //Internet Request
}
else
{
$campaign=$_SES SION['session_cmpid']; //Session Campaign
}

$engid=$_SESSIO N['session_engid'];
$kwid=$_SESSION['session_kwid'];
//////////////////////////////////////////////////////////////////////
Top of confirm page:
<?php
session_start() ;
$campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
echo 'Campaign is '.$campaign;
////////////////////////////////////////////////////////////////////
Jul 17 '05 #1
0 1429

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
23336
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 The problem I am having is that each time I reload the same PHP page, I get
8
3973
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
3
3444
by: Mark | last post by:
Ok, I know that .net inherently does not share session data across asp.net projects, but is there any decent work around to this. We already have a big chunk of our application using the asp.net session object (using state service). I'd like to start breaking out our functionality into component projects, but I'd like to get this session issue worked out first. Any ideas?? I found this article , but it sounds like kind of a pain.
5
8926
by: VB Programmer | last post by:
I often use session variables to store the user's security level, and other important info. How secure are session variables? Can someone decrypt it and get the information? (This would be especially important to know if the session vars contain things like credit card numbers.) Any better, more secure alternatives? How would you store credit card numbers etc... temporarily if not using session vars? Thanks!
2
2565
by: Jeff | last post by:
....still new to .net 2005 using VB. Do I understand correctly that the value of a session variable is actually stored in the server's ram, but relies on the asp.net session ID cookie that temporarily is placed on the client's machine until the session ends? ...so that you can't use session variables if the client has disabled cookies on their browser? So, this makes session vars much more secure than hidden fields, which are transmitted...
5
1686
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to the forums package. The creator of the forums package provides what seems to be an easy workaround for this. Create two session variables, one for ID, the other for Password, and his program will take care of the rest. I have all of my forums...
1
3096
by: Rogier | last post by:
Hello, I made a simple script with some session variables. When I work in the application, and when I don't use the application for some time, the session vars are erased... even when I set the session time out for 4 hours.... Here is a part of the code: <?PHP
5
6135
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
4
6339
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59 Notice: Undefined index: args in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92 Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.