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 7415483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:18:43+00:00 2026-05-29T07:18:43+00:00

hello i am trying to pass a cookie from one page to another, and

  • 0

hello i am trying to pass a cookie from one page to another, and its just not working for some reason

i set the cookie in php.

Page a:

   <?php $cc= 'testcookie';
    setcookie("cc", $video, time()+36000);
     ?>

and i try to read the cookie in JS.

Page b:

function readCookie(name) {  

var cookiename = name + '=';  

var ca = document.cookie.split(';');  

for(var i=0;i < ca.length;i++)  
{  

    var c = ca[i];  

    while (c.charAt(0)==' ') c = c.substring(1,c.length);  

    if (c.indexOf(cookiename) == 0) return c.substring(cookiename.length,c.length);  

}  

return null;  
}

and i always get null…

when i try to set the cookie in the same page that i try to read it, it works…

any ideas?

  • 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-05-29T07:18:44+00:00Added an answer on May 29, 2026 at 7:18 am

    You may try setcookie("cc", $video, time()+36000, "/", "example.com"); to specify the domain and the path. "/" mean full domain. And sometimes there may occur some problems with cookies if try to use them on the http://localhost/ .

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

Sidebar

Related Questions

Im trying to pass some variables from the URL to the PHP script. Now
Hello I am trying to pass in varrays from PHP to Oracle. I am
Hello I am trying to pass different urls from my site into a template.
Hello I'm trying something .. I was reading Jquery traversing documentations some forums, this
Hello I been trying to figure out how to set up ASP.Net forms authentication
I am trying to pass a variable from a function to a class. Example
I'm trying to pass some parameter to a function used as callback , how
I'm trying to pass a value from html to a function but when I
I'm new to using classes and I'm trying to pass a variable to one
Hello I am a newbie working with jQuery and Ajax. I am trying submit

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.