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

  • Home
  • SEARCH
  • 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 784481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:43:14+00:00 2026-05-14T20:43:14+00:00

at index.php i have a form to fill out some settings. the form posts

  • 0

at index.php i have a form to fill out some settings. the form posts to setsettings.php

at setsettings.php it uses the form data and sets some cookies and redirect back to index.php. if i print_r($_COOKIE) at setsettings.php all is well. but nothing comes up at index.php, the $_COOKIE array is empty 🙁

Does somebody know how i go about solving this?

I set det setting by (setsettings.php):

/* Write new cookie */
$expire = 60 * 60 * 24 * 60 + time();  // ~2 months
setcookie("user_var_001", $_POST['selection'], $expire);

and in index.php print_r($_COOKIE) turns up blank;

  • 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-14T20:43:15+00:00Added an answer on May 14, 2026 at 8:43 pm

    Copy-paste from PHP: setcookie comments:

    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'); 
    ?>
    

    I suggest searching that page for “redirect”, there is also some problem described about IIS.

    P.S. Try without the redirect and see if the cookie is set after you refresh the page.

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

Sidebar

Related Questions

I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
Let's say we have index.php and it is stored in /home/user/public/www and index.php calls
I have an index.php file which has to process many different file types. How
I have this rewrite rule RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is
I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php
From http://projecteuler.net/index.php?section=problems&id=99 Comparing two numbers written in index form like 2 11 and 3
Let's imagine I got this: index.php generates form with unpredictable number of inputs with
include 'header.php'; // ... some code header('Location:index.php'); exit; The above code keeps giving me
I wanna rewrite links like index.php?page=entry&id=15&action=edit to entry/15/edit . This is how my .htaccess
I am wondering how I can break up my index.php homepage to multiple php

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.