|
problem with php (please read carefully before replying) -
December 25th, 2007
posting this question 3rd time.? I am having 2 php pages as follows:
1. random_code.php in which a number is generated by certain way.
2. index.php in which this random_code.php file is called.
random_code.php contains:
----------------------
<?php
session_start();
$chars = 'abcdefghijklmnopqrstuvxyz0123456789'; // possible characters
$max = strlen($chars) - 1;
for ($i=0; $i<8; $i++) {
$position = rand(0, $max);
$code[] = $chars{$position};
}
$code = implode('', $code);
$_SESSION['codes']=$code;
/* below are the coded that will generate the image"
which i am not writing here*/
?>
index.php contains:
----------------------
<?PHP session_start(); ?>
<img src="random_code.php" alt="random code">
<?php
echo $_SESSION['codes']; <~ no given result
?>
Note: Image is been generated correctly.
I only want to know that why my echo $_SESSION['codes']; is not working in index.php.
to work session properly is special settings required in php.ini?
|