PDA

View Full Version : session not started without print $session->header :(


bazz
06-03-2008, 03:51 PM
Thought I had my session sorted for the bookings system until I switched off the line


print $session->header;



If I leave it on, it displays the header content in the page if I leave it off, the session doesn't work properly such, that the data isnm;t passed to the session by this form.

here is the start of the script.


#!/usr/bin/perl -w

use CGI;
use CGI::Carp qw(fatalsToBrowser);
use strict;
use DBI;
use Date::Manip;
use CGI::Session;
use POSIX;
my $cgi = new CGI;
use Date::Parse;
use Date::Format;
use Data::Dumper;

#use lib '/var/www/vhosts/mydomain/subdomains/hotel/cgi-bin/';
use lib '../cgi-bin/';
use lib '/var/www/vhosts/mydomain/subdomains/cms/cgi-bin/';
use lib '/var/www/vhosts/mydomain/subdomains/cms/cgi-bin/EazyModules/';

my $session = new CGI::Session($cgi);# or die CGI::Session->errstr;

print $session->header; # if I delete this line, the session doesn't get the data


What can I do about it?

bazz

FishMonger
06-03-2008, 11:53 PM
print $session->header; # if I delete this line, the session doesn't get the dataIf your page is being displayed without this line, then you must have another line elsewhere that outputs the header, otherwise you'd be receiving a fatal error.

Look for:
print $cgi->header; and remove it.