473,804 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($_COOKI E);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$del ay.';url='.$url .'">';
Jul 17 '05 #1
2 1900
I should mention that somepage.php has frames.

Thanks

"Katherine Hall" <ka*******@mana iakoru.com> wrote in message
news:r5******** ***********@new s20.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($_COOKI E);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$del ay.';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($_COOKI E);
$url = "../somepage.php";
$target = "parent";
$delay = "4";
echo '<meta http-equiv="refresh" content="'.$del ay.';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("myna me","Katerine Hall");
header("Locatio n: page2.php");
?>

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

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
11320
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 ($hasLoggedIn && ($row = mysql_fetch_row($query))) { setcookie('nordicnet_registration', $row, 0, '/'); @mysql_free_result($query);
3
3406
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 parameter 2 to be string object given in *.php on line 21 21: while (!setcookie("USER",$User, time()+3600)) { 22: $errmsg = $Unable_to_register_txt; 23: LogMsg($errmsg);
5
6464
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 sent by (output started at D:\Apache Group\Apache2\htdocs\YC\songs.php:4) in D:\Apache Group\Apache2\htdocs\YC\ycphpfunc.php on line 148 My .php file looks like this:
6
2078
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 has something like this: <?php setcookie('code',$value, time + $lifetime, '/', '.example.com'); ?>
3
2299
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 encountered this, but without any luck, so I now resolve to pose the question myself. Code: <?php $somedata="Lorem Ipsum";
6
2676
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, or how I trace them? Also, I created cookies using this command: $string_to_check = $type."_".$pid; setCookie("$string_to_check", "1", time()+30*1); The cookie doesn't expire in 30 seconds - in fact, it doesn't seem to expire at all.
9
2298
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." 4. Display last modified date of doc. Here is my attempt. What a headache :-(
8
5873
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 checked to make sure that the variables have values and that the proper expire time is set and etc. Any ideas? <?php foreach($_POST as $name => $value){ if($name == 'hItem'){ $item = $value;
9
26261
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 than a function to set and retrieve the cookie but still nothing. Why is this happening?
0
9575
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10564
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10073
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.