473,216 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

SESSIONS

Hi all,

I'm trying to get the hang of Sessions using this little test program
shown below. However, the first page starts up a couple of session
variables (if they have not been started already), and invites the
user to enter a name. The second page then takes this name, adds it
to an array, and invotes the user to go back to the original page
(where hopefully his name has been added).

Any comments appreciated, Thanks

Andy
//sessionTest1.php
<?php
session_start();
header("Cache-control: private");
header("Cache-Control: no-store, no-cache, must-revalidate");
error_reporting(E_ALL);
ini_set('display_errors', '1');

?>
<html>
<body>
<form action ="sessionTest2.php" method = "post">
<p>Enter your name:</p>
<input type = 'text' name = 'textEntry'/>
<input type = 'submit' value='submit'/>
</form>

<?php

$condition=isset($names);
if(!$condition)
{
$names = array();
$i = 0;
$_SESSION['i'] = $i;
$_SESSION['names'] = $names;
}
else
{
$names = $_SESSION['names'];

for($i=0; $i<count($names); $i++)
{
echo "$names[$i]";
}

}

?>

</body>
</html>

-------------------------------------------------------------------------

//sessionTest2.php
<?php
session_start();
header("Cache-control: private");
header("Cache-Control: no-store, no-cache, must-revalidate");
?>

<html>
<body>
<form action = 'sessionTest.php' method = 'post'>
<input type = 'submit' value = 'back'/>
<?php

$names = $_SESSION['names'];
$count = $_SESSION['count'];
$lastName = $_POST['textEntry'];
$names[$count] = '$lastName';

$_SESSION['names'] = $names;
$tester = $_SESSION['names'];
echo $tester[0];
//header("Location: sessionTest.php?output=$foo");


?>
</form>
</body>
</html>
Jul 17 '05 #1
6 1916
I noticed that Message-ID:
<b2**************************@posting.google.com > from Andy contained
the following:
Any comments appreciated, Thanks


The weather is changeable isn't it?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Andy wrote:
(snip)
-------------------------------------------------------------------------

//sessionTest2.php
<?php
session_start();
header("Cache-control: private");
header("Cache-Control: no-store, no-cache, must-revalidate");


You missed the all important error reporting here, in sessionTest2.php

error_reporting(E_ALL);
ini_set('display_errors', '1');

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #3
LOL

"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:69********************************@4ax.com...
I noticed that Message-ID:
<b2**************************@posting.google.com > from Andy contained
the following:
Any comments appreciated, Thanks


The weather is changeable isn't it?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

Jul 17 '05 #4
Geoff Berrow <bl******@ckdog.co.uk> wrote in message news:<69********************************@4ax.com>. ..
I noticed that Message-ID:
<b2**************************@posting.google.com > from Andy contained
the following:
Any comments appreciated, Thanks


The weather is changeable isn't it?


Thanks geoff.
Jul 17 '05 #5
I noticed that Message-ID:
<b2**************************@posting.google.com > from Andy contained
the following:
>Any comments appreciated, Thanks


The weather is changeable isn't it?


Thanks geoff.


No problem. :-)

Since you didn't actually ask a question, it was as good as any...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6
> No problem. :-)

Since you didn't actually ask a question, it was as good as any...


Fair comment...

Anyway, I live in Glasgow where the weather isn't changeable at all.
It always bloody rains ;-)

I'll try to make more appropriate postings in future.

Andy
Jul 17 '05 #7

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

Similar topics

2
by: The Plankmeister | last post by:
Hi... I'm trying my hardest to understand fully how sessions work and how best to use them. However, all I can find is information that doesn't tell me anything other than that sessions store...
13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
3
by: Maxime Ducharme | last post by:
Hi group We have a problem with sessions in one of our sites. Sessions are used to store login info & some other infos (no objects are stored in sessions). We are using Windows 2000 Server...
3
by: Will Woodhull | last post by:
Hi, I'm new here-- I've been reading the group for a couple of days. Nice group; I like the way n00b33 questions are handled. I've been using a Javascript routine in index.html to determine a...
2
by: Steve Franks | last post by:
According to the docs you tell ASP.NET to use cookieless sessions by setting a value in the config.web file. However, what if I wanted to determine at run time whether or not I wanted to use...
12
by: D. Shane Fowlkes | last post by:
This is a repost (pasted below). Since my original post, I've double checked the system clock and set all IIS Session Timeout values to 10 minutes. Still ...the problem occurs. I've also...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
22
by: magic_hat60622 | last post by:
Hi all. I've got an app that dumps a user id into a session after successful login. the login page is http://www.mydomain.com/login.php. If the user visits pages on my site without the www (i.e.,...
13
Frinavale
by: Frinavale | last post by:
One of the most fundamental topics in web design is understanding how to pass information collected on one web page to another web page. There are many different ways you could do this: Cookies,...
3
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.