473,379 Members | 1,377 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,379 software developers and data experts.

session - save data

Hi,

I would like to enable ppl a country choice on the first page and it should
be saved while they're resting on my site so i can pre-select it on the
contact form, I tried following:
[top of index.php - nothing above]
<?php
session_start(); // start up your PHP session!
if ($_POST['country'])
{
$_SESSION['country']=$_POST['country'];
echo "counry's been saved as: ".$_SESSION['country'];
}
?>
[/top of index.php - nothing above]
[contact.php (where i wanna use the info)]
<?php
if ($_SESSION['country'])
{
echo $_SESSION['country'];
}
....
....
[/contact.php (where i wanna use the info)]
it wouldn't echo anything on contacvt.php....what have i forgotten/overseen?
Help apprecaited!
Thanks very much!

roN
Dec 6 '06 #1
1 1585
roN
"shawnews" <ex*****@example.comwrote in message
news:GjEdh.438300$R63.352280@pd7urf1no...
Hi,

I would like to enable ppl a country choice on the first page and it
should be saved while they're resting on my site so i can pre-select it on
the contact form, I tried following:
[top of index.php - nothing above]
<?php
session_start(); // start up your PHP session!
if ($_POST['country'])
{
$_SESSION['country']=$_POST['country'];
echo "counry's been saved as: ".$_SESSION['country'];
}
?>
[/top of index.php - nothing above]
[contact.php (where i wanna use the info)]
<?php
if ($_SESSION['country'])
{
echo $_SESSION['country'];
}
...
...
[/contact.php (where i wanna use the info)]
it wouldn't echo anything on contacvt.php....what have i
forgotten/overseen?
Help apprecaited!
Thanks very much!
Got it, thank you anyways, i just needed to start the session by
"session_start(); " in contact.php as well :)
Thanks!

roN
Dec 6 '06 #2

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

Similar topics

5
by: Martien van Wanrooij | last post by:
Some time ago I already posted a question about a site that consists of several pages where the visitor, on every page can answer one or two questions in order to fill out an intake for for an...
15
by: | last post by:
Hi, I want to do things this way: I have a bunch of stuff that I want to keep track of while a user is connected to the site. Maybe 50 little peices of information. So I know I can make 50...
11
by: Vic Spainhower | last post by:
Hello, I just purchased a new domain name and I've set it up as a redirect to a folder on my main site. What is happening is the index.php page checks a session variable to see if the user is...
8
by: mirek | last post by:
Hi, Is it safe to put my objects that are managed c++ wrappers to the session? I want to pass them from one page to the other in the session object but I noticed strange (maybe it is ok)...
8
by: Joe Abou Jaoude | last post by:
hi, I have a web app with forms authentication and a timeout session of 20 mins for security reasons. I recently added a feature that allows users (if they want to) to automatically log in...
5
by: Just D. | last post by:
Do we have any access to the Session object from a different Session? The idea is to save Session of a current user and then if he logs in again then return the Session back. It's not a problem to...
9
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later...
2
by: Gordon Burditt | last post by:
I had this idea about preventing session fixation, and I'm wondering what anyone else thinks about it. The idea is, essentially, don't allow session ids that YOUR PHP didn't generate (and aren't...
3
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
1
by: Andy | last post by:
Hi Gang I need help. I have an ASP application that in a nutshell allows data entry on a main page. The problem is I'll have users that enter some data and save it. Then they'll enter some...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.