Hi Tedd,
tedd schrieb:
At 2:45 PM +0200 8/16/08, Sabine Richter wrote:
Yes, our mails overlaped each other (Do you say that in english? My
english is not the best.)
Sabine:
Your English is fine -- much better than my de for certain.
Thanks :-)
By the way: I tried your initial code and I had no problem with the
variable declared after the numeric ones. (your $_SESSION['test']). I
tried on a Version 5.2.5 an Win XP.
That's interesting.
Let's make sure we're talking about the same thing here.
This is the demo:
http://www.webbytedd.com/b2/session-test1/index.php
In my browser Step 1 shows:
SESSION[20] => good morning
SESSION[test2] => good night
In Step 2:
Neither are there.
Is that what you see?
I tried the script from your first example on
http://www.webbytedd.com/b2/session-test/index1.php
I just deleted the header and footer includes and set the error
reporting to E_ALL.
That's what I get:
index.php:
f411abf8cb6cb7e0f2d091251c1906dd
Step 1 -- SESSIONs Recorded
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
10 = 10
hello
Code:
<?php
// Session problem tedd sperling, php liste 15.08.2008
ini_set('error_reporting', E_ALL );
if (session_id() == "")
{
session_start();
}
echo(session_id());
for ($i = 1; $i <= 10; $i++)
{
$_SESSION[$i] = $i;
}
$_SESSION['test'] = 'hello';
?>
<h1>Step 1 -- SESSIONs Recorded</h1>
<?php
for ($i = 1; $i <= 10; $i++)
{
echo("$i = $_SESSION[$i] <br/>");
}
echo($_SESSION['test']);
?>
<br/>
<br/>
<form action="index1.php" method="post">
<input type="submit" value="Proceed to Step 2">
</form>
<hr/>
Code:
<br/>
<br/>
<?php highlight_file ("index.php"); ?>
Notice: Unknown: Skipping numeric key 1. in Unknown on line 0
Notice: Unknown: Skipping numeric key 2. in Unknown on line 0
Notice: Unknown: Skipping numeric key 3. in Unknown on line 0
Notice: Unknown: Skipping numeric key 4. in Unknown on line 0
Notice: Unknown: Skipping numeric key 5. in Unknown on line 0
Notice: Unknown: Skipping numeric key 6. in Unknown on line 0
Notice: Unknown: Skipping numeric key 7. in Unknown on line 0
Notice: Unknown: Skipping numeric key 8. in Unknown on line 0
Notice: Unknown: Skipping numeric key 9. in Unknown on line 0
Notice: Unknown: Skipping numeric key 10. in Unknown on line 0
index1.php:
f411abf8cb6cb7e0f2d091251c1906dd
Step 2 -- Results of SESSIONs passed
Notice: Undefined offset: 1 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
1 =
Notice: Undefined offset: 2 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
2 =
Notice: Undefined offset: 3 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
3 =
Notice: Undefined offset: 4 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
4 =
Notice: Undefined offset: 5 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
5 =
Notice: Undefined offset: 6 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
6 =
Notice: Undefined offset: 7 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
7 =
Notice: Undefined offset: 8 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
8 =
Notice: Undefined offset: 9 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
9 =
Notice: Undefined offset: 10 in
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21
10 =
hello
Code:
<?php
// Session problem tedd sperling, php liste 15.08.2008
ini_set('error_reporting', E_ALL );
if (session_id() == "")
{
session_start();
}
echo(session_id());
?>
<h1>Step 2 -- Results of SESSIONs passed</h1>
<?php
for ($i = 1; $i <= 10; $i++)
{
echo("$i = $_SESSION[$i] <br/>");
}
echo($_SESSION['test']);
?>
<br/>
<br/>
<form action="index.php" method="post">
<input type="submit" value="Go Back to Step 1">
</form>
<hr/>
Code:
<br/>
<br/>
<?php highlight_file ("index1.php"); ?>
You see, I get the content of $_SESSION['test'] in index1.php.
It's the same as in your second example, isn't it?
I would try your second example too, but you highlighted the code of
index.php in index1.php too. So I can't.
Cheers
Sabine
Cheers,
tedd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php