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

setcookie

I am trying to set a cookie and use it later, but as soon as put a redirect
or anything, I loose it.

So when I first print it out, it exists. When I go to my redirect page it's
gone.
first page:

print_r($_COOKIE);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
Jul 17 '05 #1
2 1768
I should mention that somepage.php has frames.

Thanks

"Katherine Hall" <ka*******@manaiakoru.com> wrote in message
news:r5*******************@news20.bellglobal.com.. .
I am trying to set a cookie and use it later, but as soon as put a redirect
or anything, I loose it.

So when I first print it out, it exists. When I go to my redirect page
it's gone.
first page:

print_r($_COOKIE);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';

Jul 17 '05 #2
Katherine Hall wrote:
I am trying to set a cookie and use it later, but as soon as put a redirect
or anything, I loose it.

So when I first print it out, it exists. When I go to my redirect page it's
gone.
first page:

print_r($_COOKIE);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';


How do you set your cookie?

You'll have to show us a little more code before I can advise where you
are going wrong - And you could/should used the header() function to
redirect as opposed to the meta http-equiv tag you're using.

Start simple first, then work your way from there - Thus, create a
simple page that says something like

A file called page1.php follows:

<?
setcookie("myname","Katerine Hall");
header("Location: page2.php");
?>

A file called page2.php follows:
<?
print_r($_COOKIE);
?>

The above should work - when you've tweaked with it a bit and got it
working, then implement the code in to your real life scenario.

Hope that helps,
randelld.
Jul 17 '05 #3

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

Similar topics

16
by: Phil Powell | last post by:
Fourth attempt.. it fails now in login, I check by printing $_COOKIE and there is no value there! Guys, what on earth do I do about this???? Here is the code that sets the cookie: if...
3
by: RotterdamStudents | last post by:
For registering a user to one of my sportleagues i use a little part of undeneath script to set a cookie. but this returns the next fault when a new user registers: Warning: setcookie()expects...
5
by: Ben | last post by:
Hi all, In my .php file, I'm using both session_start() and setcookie() before <html> tag. It gives me following warning message: Warning: Cannot modify header information - headers already...
6
by: GregoryD | last post by:
I'm going to try to simplify this issue as much as possible. In my public_html/ directory, I have a login script that sets a cookie to be used for authentication purposes. To set the cookie, it...
3
by: Cmaza | last post by:
Hi, I've been dealing with PHP for a few years now and I've never encountered a problem quite like this. I've searched the net for an answer to my problem hoping somebody else may have...
6
by: knkk | last post by:
I am not able to locate the cookies created by the setCookie function. They are not in the standard IE folder where temporary Internet files and cookies are placed. Does anyone know where I search,...
9
by: LayneMitch via WebmasterKB.com | last post by:
Hello. Got another one for you folks. I'm working on this problem that wants me to 1. Prompt for name 2. Use pop-up box with name 3. Display current date on page in format "October 30, 2000."...
8
by: SupraFast | last post by:
I have two hosting accounts. On one, my setcookie script works fine; cookies are created. On the other, the same script doesn't work. The function returns TRUE, but no cookies is created. I...
9
by: wangers16 | last post by:
Hi, I am quite new to PHP and recently I have been attempting to create a login script, just one problem, the setcookie function isn't working. I have tried a basic php file with nothing other...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.