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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:23:07+00:00 2026-06-08T20:23:07+00:00

I use a cookies values into a project to check the visitors entered, firstly,

  • 0

I use a cookies values into a project to check the visitors entered, firstly, a submit post form exist to enter an email address, after submit, the cookies is set (for next navigation to the current page, should be enter direct to the home page not to the form page if cookies is set), everything goes right, the cookies is set properly , but after navigation to another page the data is lost and no cookies exist!!! is right that cookies should be valid in all pages navigation?? the below figure some codes…

if((!$_COOKIE["tickets"] && $_COOKIE["email_address"]) || (empty($_COOKIE['tickets']) && empty($_COOKIE['email_address']))){
$access_vcount=intval(getCurrentValueAccess())+1;
if(getCurrentValueAccess()==0){$query_vcounts=mysql_query("insert into visitors_counter(counter) VALUES('$access_vcount')");}
else{$query_vcounts=mysql_query("update `visitors_counter` set counter='".$access_vcount."'");}
setcookie("tickets", "accessible", time()+86400);
setcookie("email_address", $email_address, time()+86400);
}
header("Location:".BURL."/".getflink(2,'en'));  

The cookies are valid for a one day (should be that).
When i try to print the values is cookies in another page , then no result.

Thank you for your suggestions.

  • 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-08T20:23:08+00:00Added an answer on June 8, 2026 at 8:23 pm

    When setting a cookie on a page that redirects, the cookie must be set after the call to header(‘Location: ….’);

    Such as:

    <?php
      header('Location: http://www.example.com/'); 
      setcookie('asite', $site, time()+60*60, '/', 'site.com');  ?>
    

    Pasted from comments at http://de3.php.net/manual/en/function.setcookie.php

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

Sidebar

Related Questions

Am planning to use cookies to communicate between two browser windows. Am wondering if
I understood that in order to use cookies inside of phonegap native app there
This is an interview question asked a month ago.... Do session use cookies? If
Anyone know how I can use httponly cookies for sessions and cookies on the
I'm attempting to use localStorage as a cookie replacement (detest cookies) so users can
I am trying to use PHP session without using cookies. I have enabled session.use_trans_sid
Background: I'm acquireing cookies through my app and use them internally by making requests
Is it safe to use such code? Response.Cookies[cookieName].Path = Request.ApplicationPath + /; I want
I'm wondering if it's possible to use a wildcard to select multiple cookies. I'm
Try to download this page: http://www.4shared.com/get/B4AgMkcw/cookies.html I can use wget/firefox to get the whole

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.