Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:16:38+00:00 2026-06-15T12:16:38+00:00

When I first create a cookie I don’t seem to be able to grab

  • 0

When I first create a cookie I don’t seem to be able to grab that same cookie until a subsequent page load. It’s as if the cookie doesn’t exist to the browser until the page is requested a second time.

I’m using the Kohana PHP framework:

Cookie::set('new_cookie', 'I am a cookie');
$cookie = Cookie::get('new_cookie');
//$cookie is NULL the first time this code is run. If I hit the page again
and then call Cookie:get('new_cookie'), the cookie's value is read just fine.

So, I’m led to believe that this is normal behavior and that I probably don’t understand how cookies work. Can anyone clarify this for me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:16:40+00:00Added an answer on June 15, 2026 at 12:16 pm

    Cookies are set in HTTP headers, so when the server returns the page.
    When you reload the page, your browser will send them back to the server.

    So, it is perfectly normal they are “visible” just after a new request.

    Here is an example response from the server:

    HTTP/1.1 200 OK
    Content-type: text/html
    Set-Cookie: name=value
    Set-Cookie: name2=value2; Expires=Wed, 09-Jun-2021 10:18:14 GMT
    
    (content of page)
    

    When you reload the page, your browser sends this:

    GET / HTTP/1.1
    Host: www.example.org
    Cookie: name=value; name2=value2
    Accept: */*
    

    This is why the server can see them only after a new request by the browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I would like to have an easy code that creates a cookie called
How to create dynamically tag inside table. At first create link then inside link
First I create some backbone views: (function() { var SomeView = Backbone.View.extend({ ... });
I am using EF Code First to create a database on local .\SQLEXPRESS. Among
I'm having issues using my class to create a mouse listener. First I create
UPDATE: This is the working example. First we create a class to hold weekday,
I try the tutorial on net to build chat room. First I create a
I'm after a simple stored procedure to drop tables. Here's my first attempt: CREATE
I create my first iphone app now i want submit this on appstore so
this is my first attemp to create a frontController and I've come over some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.