Jump to content
nuahssiaram

Help With Cookies

Recommended Posts

Hi, I have just started learning php and I am trying to make a mobi site send a cookie so that visitors can switch between mobile and full site views. I feel like I have tried everything. I don't think the cookie is sending. I am using Google Chrome to search for the cookie, but nothing comes up. Is the following code right?I have placed it on the first line of code "before any html is sent"(according to the tutorials).

<?php  $expireDate = time() +3600;  setcookie("testcookie", "formywebsite", $expireDate, "/", "mobi.website.com");?>

Share this post


Link to post
Share on other sites

how do you know it is not seting the cookie? how did you checked it?

Share this post


Link to post
Share on other sites

Make sure the domain matches the site you're testing on. This may not work if you're testing on localhost.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...