jeddi
02-25-2008, 11:20 AM
Hello,
Am a bit new to using sessions and I have got a bit confused.
I am passing a session variable for the captha image.
My index.php starts off with:
<?php
/*
* index.php
*
*
* calls my_functions.php
* and first_page_fm.php
* and a_client_chk.php
* and b_email_act.php
* and confirm_disp.php
*
*
*/
session_start()
require_once("my_functions.php");
now later on it includes a form script:
require_once("first_page_fm.php"); // run BIG FORM
exit();
Inside the form the captcha script is run with the image
like this:
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"> </a></span>
Inside captcha.php
the session var is set:
$_SESSION['key'] = md5($string);
Now the form script re-runs index.php
which processes the form data.
i.e.
<form name="main_fm1" action ='index.php' method = 'POST'>
So when the index re-runs (from the form) and the "session_start()" is encountered again, does the $_SESSION['key'] variable get lost ?
or does the "session_start()" pass it on ?
If passed on, this code should display it:
$keytxt =$_SESSION['key'];
ECHO "Keytext: $keytxt";
But it shows up as empty :o
Any ideas on what I am doing wrong ?
Thanks for any input.
Am a bit new to using sessions and I have got a bit confused.
I am passing a session variable for the captha image.
My index.php starts off with:
<?php
/*
* index.php
*
*
* calls my_functions.php
* and first_page_fm.php
* and a_client_chk.php
* and b_email_act.php
* and confirm_disp.php
*
*
*/
session_start()
require_once("my_functions.php");
now later on it includes a form script:
require_once("first_page_fm.php"); // run BIG FORM
exit();
Inside the form the captcha script is run with the image
like this:
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"> </a></span>
Inside captcha.php
the session var is set:
$_SESSION['key'] = md5($string);
Now the form script re-runs index.php
which processes the form data.
i.e.
<form name="main_fm1" action ='index.php' method = 'POST'>
So when the index re-runs (from the form) and the "session_start()" is encountered again, does the $_SESSION['key'] variable get lost ?
or does the "session_start()" pass it on ?
If passed on, this code should display it:
$keytxt =$_SESSION['key'];
ECHO "Keytext: $keytxt";
But it shows up as empty :o
Any ideas on what I am doing wrong ?
Thanks for any input.